DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • August 20, 2019, 11:11:03 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: A little nav help?  (Read 4100 times)
0 Members and 1 Guest are viewing this topic.
Derek
Member
Captain of the Guard
***
Offline Offline

Posts: 122


"I think I just thunk"


View Profile WWW
« on: November 20, 2005, 01:50:24 PM »

I don't know if this is the right section, but:
I made a very simple moduel that adds an option to delete all the current comments. But, my problem is not with that, as that part works fine.
I am having trubble with the navs. It seems 2 "Delete All" links are appearing, while I only have 1 addnav() function for it. I am not a total expert in moduel makeing, but I have made a few others that work fine.
Here is the portion of the code that I am having trubble with:
Code:
function delallcomments_dohook($hookname,$args){
  global $session;
  switch($hookname){
    case "moderate":
      addnav("Other");
      addnav("Delete All","runmodule.php?module=delallcomments");
    break;
  }
  return $args;
}
Anyone have any ideas?
Logged

Check out My Modules

Check us out! 1 hour days, heavily modded, friendly admins!
Derek
Member
Captain of the Guard
***
Offline Offline

Posts: 122


"I think I just thunk"


View Profile WWW
« Reply #1 on: November 20, 2005, 03:23:45 PM »

OK, new info: It seems that one of the "Delete All" links is just in the comment moderation page, but the other one is everywhere (village, forest, etc.), so it's adding 1 to the comment moderation page, and 1 to everywhere, including the comment moderation page. Whats going on?
Logged

Check out My Modules

Check us out! 1 hour days, heavily modded, friendly admins!
Talisman
Administrator
Mod God
*****
Offline Offline

Posts: 5484



View Profile WWW
« Reply #2 on: November 20, 2005, 03:32:31 PM »

Hard to say without seeing more code.
Logged

Play the latest beta version here on DragonPrime
Derek
Member
Captain of the Guard
***
Offline Offline

Posts: 122


"I think I just thunk"


View Profile WWW
« Reply #3 on: November 20, 2005, 03:45:02 PM »

Ok:
Code:
<?php
function delallcomments_getmoduleinfo(){
  
$info = array(
    
"name"=>"Delete All Comments",
    
"version"=>"0.01",
    
"author"=>"Derek0",
    
"category"=>"Administrative",
    
"download"=>"http://",
  );
return 
$info;
}

function 
delallcomments_install(){
module_addhook("moderate");
return 
true;
}

function 
delallcomments_uninstall(){
return 
true;
}

function 
delallcomments_dohook($hookname,$args){
  global 
$session;
  switch(
$hookname){
    case 
"moderate":
      
addnav("Other");
      
addnav("Delete All","runmodule.php?module=delallcomments");
    break;
  }
  return 
$args;
}

function 
delallcomments_run(){
global 
$session;
page_header("Delete All Comments");
$sql="TRUNCATE " db_prefix("commentary") . "";
db_query($sql);
output("All comments have been deleted!");
addnav("Continue","moderate.php");
page_footer();
}
?>
It's probably right under my nose, isn't it.
Logged

Check out My Modules

Check us out! 1 hour days, heavily modded, friendly admins!
Talisman
Administrator
Mod God
*****
Offline Offline

Posts: 5484



View Profile WWW
« Reply #4 on: November 20, 2005, 03:55:23 PM »

The moderate hook appears on every page with commentary, so if you're a superuser with commentary moderation privileges, you will see the link on every page.

There are two things wrong with your module as it exists now:

1.  Using it will delete every comment from every commentary area within your game.  Everything.

2.  Once completed (used), it returns you to the moderation screen as opposed to the screen from which it was originally accessed.
Logged

Play the latest beta version here on DragonPrime
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #5 on: November 20, 2005, 03:58:25 PM »

Don't Truncate the commentary, just delete. Truncate will change certain things about the table setup. Instead:
Code:
$sql = "DELETE FROM ".db_prefix("commentary")."";

I have created a module that will remove sections of commentary, rather than all in one go. Here.

For a better nav setup, use the hook: footer-moderate
« Last Edit: November 20, 2005, 04:00:11 PM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

Derek
Member
Captain of the Guard
***
Offline Offline

Posts: 122


"I think I just thunk"


View Profile WWW
« Reply #6 on: November 21, 2005, 07:50:24 AM »

I haven\'t coded in php alot, so I\'m bad a SQL commands, but shouldn\'t that be:
Code:
$sql = \"DELETE * FROM \".db_prefix(\'commentary\').\"\";
with the * symbol and with the \' instead of \" around commentary?
And yes, my fellow admins want to be abel to delete EVERYTHING in one click.
Logged

Check out My Modules

Check us out! 1 hour days, heavily modded, friendly admins!
Nightborn
Guest
« Reply #7 on: November 21, 2005, 07:52:05 AM »

No.

Code:
Select * From
... is fine

But
Code:
Delete From
is without any column selection ... what makes sense, because the entire row gets deleted... and here the whole commentary table..
« Last Edit: November 21, 2005, 07:52:22 AM by Nightborn » Logged
Pages: [1]   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
90 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search