DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • June 22, 2018, 09:49:39 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: 1 [2] 3   Go Down
  Print  
Author Topic: Require Admin Approval For Unmute??  (Read 2138 times)
0 Members and 1 Guest are viewing this topic.
TGTarheel
Codemeister
****
Offline Offline

Posts: 450


View Profile
« Reply #15 on: January 03, 2018, 08:01:14 PM »

OK...let's see if I can puzzle that out...
As much as I find it frustrating to not get a straight answer I think I know what you are doing here...

I'm glad you do, and I really hope you're seeing the benefit of it. Learning how to do something is and will be far more beneficial to you than just copy-pasting the solution without knowing how it actually works.

Let us know how you go. You're definitely getting there.

I can't get the rest of the way there...PLEASE help me...

This is what I tried now...and it JUST is not happening...
Code:
modulehook("commmute",array("userid"=>$id, "staffid"=>$session['user']['acctid'], "when"=>date("Y-m-d H:i:s")));
set_module_pref("comm","9999-99-99 99:99:99",FALSE,$id);   

$comm_muted_b = (get_module_pref("comm",FALSE,$id) != "0000-00-00 00:00:00")? ((get_module_pref("comm",FALSE,$id) == "9999-99-99 99:99:99")? 2 : 1) : 0;
$idret = "&id=".$id."&ret=".$ret."";

Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1878


You're welcome.


View Profile WWW
« Reply #16 on: January 03, 2018, 08:05:44 PM »

I can't get the rest of the way there...PLEASE help me...

This is what I tried now...and it JUST is not happening...
Code:
modulehook("commmute",array("userid"=>$id, "staffid"=>$session['user']['acctid'], "when"=>date("Y-m-d H:i:s")));
set_module_pref("comm","9999-99-99 99:99:99",FALSE,$id);   

$comm_muted_b = (get_module_pref("comm",FALSE,$id) != "0000-00-00 00:00:00")? ((get_module_pref("comm",FALSE,$id) == "9999-99-99 99:99:99")? 2 : 1) : 0;
$idret = "&id=".$id."&ret=".$ret."";



Okay. Were you putting that in the hook? All you need is the set_module_pref line (the second line). You used:
Code:
set_module_pref("comm","9999-99-99 99:99:99",FALSE,$id);
  • The "comm" is right.
  • The "9999-99-99 99:99:99" is right.
  • The third parameter is for the module - which module as we using? "muting".
  • The fourth parameter is for the user, and $id isn't set - looking at the First YoM module, we need to use $args['acctid'] instead.
Logged

TGTarheel
Codemeister
****
Offline Offline

Posts: 450


View Profile
« Reply #17 on: January 03, 2018, 08:13:54 PM »

I am going out of my mind crazy here and creating and deleting test accounts is making me batchit.

Now this is what you told me...

set_module_pref("PREF NAME?", "VALUE?", "USER?", "MODULE?"), filling out those values.


Now, my pref name is "comm" I see that.
My value is "9999-99-99 99:99:99"

(it does NOT seem to be setting the comm pref to 99999999999999 when I make my test accounts.)
This may be where my problem lies.


My user...this could be where I am having a problem...but I do not see how ELSE to call the user ID...right??
Should I maybe just do a variable that captures $session['user']['id'] and plug that in?

Now I should not need to name the module...since it is in the SAME MODULE.

So it SEEMS...to the way my brain is working...


set_module_pref("PREF NAME?", "VALUE?", "USER?"), filling out those values. - SHOULD WORK.


thus...
$id = $session['user']['acctid'];
set_module_pref("comm?", "9999-99-99 99:99:99", FALSE, $id),

OUGHT to work?

if not, i am completely flummoxed to hell and back.


Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1878


You're welcome.


View Profile WWW
« Reply #18 on: January 03, 2018, 08:20:45 PM »

I told you what to use in my last post.

"muting" for the third parameter (doesn't matter if it's the same module, it works either way), $args['acctid'] for the fourth.
Logged

TGTarheel
Codemeister
****
Offline Offline

Posts: 450


View Profile
« Reply #19 on: January 03, 2018, 08:22:00 PM »

I told you what to use in my last post.

"muting" for the third parameter (doesn't matter if it's the same module, it works either way), $args['acctid'] for the fourth.

so FALSE should not be there??

Code:
case "process-create":
$id = $args['acctid'];
set_module_pref("comm?", "9999-99-99 99:99:99", "muting", $id);
        break;

Let me try this...arrrrgh, I hate this stuff!!


NOOOOOOOOOOOOOOOPE!!!

that did not work EITHER!!

it still did not set the damn pref...and it still did not mute the new player.
« Last Edit: January 03, 2018, 08:25:11 PM by TGTarheel » Logged
TGTarheel
Codemeister
****
Offline Offline

Posts: 450


View Profile
« Reply #20 on: January 03, 2018, 08:28:51 PM »

where in the name of HELL does that FALSE come in...or shold it??

I STILL do not get the damn thing changing the pref on the character and I do NOT understand why...

THIS did not work...
Code:
case "process-create":
set_module_pref("comm?", "9999-99-99 99:99:99", "muting", $args['acctid']);
        break;

oh, crap.  There is a stupid extra question mark in the pref name....in my code there...damn it.
« Last Edit: January 03, 2018, 08:30:33 PM by TGTarheel » Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1878


You're welcome.


View Profile WWW
« Reply #21 on: January 03, 2018, 08:31:22 PM »

oh, crap.  There is a stupid extra question mark in the pref name....in my code there...damn it.

Yep, there you go. Should work straight away now.
Logged

TGTarheel
Codemeister
****
Offline Offline

Posts: 450


View Profile
« Reply #22 on: January 03, 2018, 08:32:29 PM »

EUREKA!!!
Logged
TGTarheel
Codemeister
****
Offline Offline

Posts: 450


View Profile
« Reply #23 on: January 03, 2018, 08:34:26 PM »

thanks, Aeolus!

This stuff is enough to drive one crazy!!

One little misplaced question mark or comma or whatever...arrrgh.

Got it now.  And I also installed The Cell...to isolate players who cause trouble after the fact.

Not much else to do.

people will be idiots...and that is life...but I'd like to have tools to deal with it as best I can.

There is one thing...minor...

I get my mute message twice.
Once initially, and once when Live Commentary turns off.

No huge problem.
« Last Edit: January 03, 2018, 08:37:59 PM by TGTarheel » Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1878


You're welcome.


View Profile WWW
« Reply #24 on: January 03, 2018, 08:35:52 PM »

thanks, Aeolus!

This stuff is enough to drive one crazy!!

One little misplaced question mark or comma or whatever...arrrgh.

Got it now.  And I also installed The Cell...to isolate players who cause trouble after the fact.

Not much else to do.

people will be idiots...and that is life...but I'd like to have tools to deal with it as best I can.

Logged

TGTarheel
Codemeister
****
Offline Offline

Posts: 450


View Profile
« Reply #25 on: January 03, 2018, 08:38:51 PM »

There is one thing...minor...

I get my mute message twice.
Once initially, and once when Live Commentary turns off.

Not sure it matters a lot, but would be nice if that did not happen.


OK...one other problem...
When I go to un-mute them...it unmutes, but then I get this

SELECT * FROM news WHERE accountid= ORDER BY newsdate DESC,newsid ASC LIMIT 100
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY newsdate DESC,newsid ASC LIMIT 100' at line 1
Call Stack:
1: db_query("SELECT * FROM news WHERE ...") called from /home/savmor/public_html/bio.php on line 105


thnn if I back up
and go to the user editor then the user grotto then back to mundane, it is okay.

Can I get rid of that call stack?


For the moment, I just commented out line 104 in bio.php and it worked....but i am not sure that is the fix I really want.

by the way,
this is line 105
Code:
$result = db_query("SELECT * FROM " . db_prefix("news") . " WHERE accountid={$target['acctid']} ORDER BY newsdate DESC,newsid ASC LIMIT 100");

Is this one of these situations where the PHP is forcing a change or something?  It would seem as though this is the case, because the call stack is giving me a syntax issue.
Just not sure what the correct syntax would be.

I think my server is now running PHP 5.7 - let me check.


I never had the problem until this module...so i do not know.

Like I said, commenting out line 105 took care of the problem in the short term...but I can't see that as a permanent fix.

OMG, here I go being a dumbass again...

MySQL server version for the right syntax to use near 'ORDER BY newsdate DESC,newsid ASC LIMIT 100'

Does not matter what version of PHP...but what version of MySQL...

 Server type: MySQL
Server version: 5.6.38


I THINK...looking thru my manual...I canbnot actually use ORDER BY...with one key being DESC and one being ASC...not sure if I am reading that right

Seems it does not want to sort when one key is DESCENDING order and the other is ASCENDING order.

So...If i change one...does it solve the problem, do you all think??

Nope.  Did not work.

For now I have 105 commented out, but that is not a permanent fix and i am afraid I do not understand well enough what is in the manual to know the correct syntax for this command and Google is no help either.
« Last Edit: January 03, 2018, 09:38:54 PM by TGTarheel » Logged
TGTarheel
Codemeister
****
Offline Offline

Posts: 450


View Profile
« Reply #26 on: January 03, 2018, 09:58:19 PM »

 You can sort on multiple columns, and you can sort different columns in different directions. For example, to sort by type of animal in ascending order, then by birth date within animal type in descending order (youngest animals first), use the following query:

mysql> SELECT name, species, birth FROM pet
    -> ORDER BY species, birth DESC;


But I tried just taking out the ASC and it did not work...

Wait...it can't be this easy...could it??

change db_query to mysql>


Code:
$result = mysql>("SELECT * FROM " . db_prefix("news") . " WHERE accountid={$target['acctid']} -> ORDER BY newsdate DESC,newsid LIMIT 100");

Could it be that?? arrrgh

Not quite getting me there...somehow it does not pick up the account ID when I return to the bio.  The function works right to mute and unmute...arrgh, I just don't like what happens when I Return to Bio and I get a nnothing account come up.
« Last Edit: January 03, 2018, 10:13:11 PM by TGTarheel » Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1878


You're welcome.


View Profile WWW
« Reply #27 on: January 03, 2018, 10:18:41 PM »

It's not a PHP error. Look at the query:
SELECT * FROM news WHERE accountid= ORDER BY newsdate DESC,newsid ASC LIMIT 100

Specifically the "WHERE accountid=" part. Where accountid equals what? It's blank, that's what the error is, there needs to be something after the equals sign. The callstack is saying that the error is near "ORDER BY", not that the error is "ORDER BY".

Easiest fix to this is as following (note the single quotes after accountid):
Code:
$result = db_query("SELECT * FROM " . db_prefix("news") . " WHERE accountid='{$target['acctid']}' ORDER BY newsdate DESC,newsid ASC LIMIT 100");
Logged

TGTarheel
Codemeister
****
Offline Offline

Posts: 450


View Profile
« Reply #28 on: January 03, 2018, 10:29:12 PM »

It's not a PHP error. Look at the query:
SELECT * FROM news WHERE accountid= ORDER BY newsdate DESC,newsid ASC LIMIT 100

Specifically the "WHERE accountid=" part. Where accountid equals what? It's blank, that's what the error is, there needs to be something after the equals sign. The callstack is saying that the error is near "ORDER BY", not that the error is "ORDER BY".

Easiest fix to this is as following (note the single quotes after accountid):
Code:
$result = db_query("SELECT * FROM " . db_prefix("news") . " WHERE accountid='{$target['acctid']}' ORDER BY newsdate DESC,newsid ASC LIMIT 100");

Ah, you added single quote before and after the curlies...

I just copied your code in and I still ahve the same problem, it is NOT pulling the account ID

it DOES...however, throw a ton of news items up.  But no account ID.

I swear I don't understand.

And why can't we just plain use something I know like $session['user']['acctid']
because THAT would pull back MY account number.

And we need to pull back the player's.

So how to do it??
« Last Edit: January 03, 2018, 10:44:07 PM by TGTarheel » Logged
TGTarheel
Codemeister
****
Offline Offline

Posts: 450


View Profile
« Reply #29 on: January 03, 2018, 10:48:32 PM »

here is what I find...

Line 104, previous to this...is this:

output("`n`^Recent accomplishments (and defeats) of %s`^",$target['name']);

yet, this is what I get:

Recent accomplishments (and defeats) of

and the name is BLANK.

So it is not even pulling the account ID even before it hits this problem.
Logged
Pages: 1 [2] 3   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
49 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search