Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Addons/Mods Graveyard (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=41)
-   -   Adopts News (http://www.mysidiaadoptables.com/forum/showthread.php?t=881)

Saphira 06-01-2009 06:29 PM

RE: Adopts News
 
Hmm. I'm trying to edit site_news.php so that the people who can post news are the user groups editors and admins. This is what I've been playing with:

PHP Code:

if($isLoggedin == "yes" and $cancp == "yes"){ 

I've been trying to add somewhere:

PHP Code:

if($group == "editor"

because I figure that will allow the editor usergroup to post, as well as admins. Though I've had no luck. I've also tried:

PHP Code:

if($isLoggedin == "yes" and $group == "editors" $cancp == "yes"){ 

But then I realised that the original line is checking that the user is logged in, and that their group can access the admin CP. It's all part of one function. That's what lead me to thinking if($group == "editor") might work, because it's a separate one. Though I've been having trouble fitting it in and getting it to work properly. :3

BMR777 06-01-2009 06:37 PM

RE: Adopts News
 
If you just want to have only admins and news editors edit the page, do this:

PHP Code:

if($isloggedin == "yes"){

$mygroup getgroup();

if(
$cancp == "yes" or $mygroup 5){

// Do your stuff here

}



In this line:

PHP Code:

if($cancp == "yes" or $mygroup 5){ 

Change 5 to the numerical ID of the group you want to have access to the page. This will allow all users who can access the ACP as well as members of this group to access the page. :)

Saphira 06-01-2009 07:14 PM

RE: Adopts News
 
I had to change that a lil' bit, but I got it to work. :D

Finished code:

PHP Code:

$article_content "".$msg."<br>".$article_content."";


$group getgroup();

$cancp cancp($group);


if(
$isloggedin == "yes"){

$mygroup getgroup();

if(
$cancp == "yes" or $mygroup == 6){


$add "<a href='create_news.php'>Add News</a>";

}

else{

$add "";

}



Can someone pls confirm that I haven't just messed something up big time here? XD; (if you do I'll kill you for ruining my moment of elated-ness! =P)

Bloodrun 06-01-2009 07:16 PM

RE: Adopts News
 
Quote:

Originally Posted by Saphira
I had to change that a lil' bit, but I got it to work. :D

Finished code:

PHP Code:

$article_content "".$msg."<br>".$article_content."";


$group getgroup();

$cancp cancp($group);


if(
$isloggedin == "yes"){

$mygroup getgroup();

if(
$cancp == "yes" or $mygroup == 6){


$add "<a href='create_news.php'>Add News</a>";

}

else{

$add "";

}



Can someone pls confirm that I haven't just messed something up big time here? XD; (if you do I'll kill you for ruining my moment of elated-ness! =P)

There is one HUGE error..
Theres no me in it..
lol =P only kidding, nicely done. =D

Saphira 06-01-2009 07:55 PM

RE: Adopts News
 
Haha thank you. now all I need to do is figure out that pesky aspostrophe. ¬.¬

The triforce power shall help me! Â â–²
                                           ▲ –²

Bloodrun 06-01-2009 07:58 PM

RE: Adopts News
 
Quote:

Originally Posted by Saphira
Haha thank you. now all I need to do is figure out that pesky aspostrophe. ¬.¬

The triforce power shall help me! Â â–²
                                           ▲ –²

Oh no, not this forum too >.<

Saphira 06-01-2009 08:02 PM

RE: Adopts News
 
I know what forum you're referring to, but I was referring to Zelda. =P

Quote:

The Triforce (トライフォース, Toraifōsu?) is a triangular relic which features throughout the series as a nearly-omnipotent sacred item representing the essences of the Golden Goddesses. It is made up of three smaller triangles known as the Triforce of Wisdom, Triforce of Power and Triforce of Courage. Each of these embody the essence of their respective goddess, and bestow certain boons on their bearers. As shown in The Legend of Zelda and The Wind Waker, each piece can be further subdivided, though they become powerless in this state.

Saphira 06-02-2009 08:13 AM

RE: Adopts News
 
IDIDITIDIDITIDIDIT!

PHP Code:

// Find highest answer number.
$query "SELECT MAX(nid) AS Max_nid FROM ".$prefix."news";
$result mysql_query($query);

    
$Max_nid=@mysql_result($result,"Max_nid");

// add + 1 to highest answer number and keep it in variable name "$Max_id". if there no answer yet set it = 1
if ($result) {
$Max_idd $Max_nid+1;
}
else {
$Max_idd 1;
}


$topic $_POST['topic'];
$topic secure($topic);
$detail $_POST['detail'];
$deatil secure($detail);
$name $_POST['name'];
$name secure($name);
$datetime date('d/m/y h:i:s');
$datetime secure($datetime); //create date time

$topic addslashes($topic);
$detail addslashes($detail);

    
$query "INSERT INTO ".$prefix."news(topic, detail, name, nid, datetime) VALUES('".$topic."', '".$detail."', '".$name."', '".$Max_idd."', '".$datetime."')";
    
$result mysql_query($query); 

I'm like, so happy right now. :P I was getting sick of writing "I'm testing using apostrophes." lol.

WHO'S THE MAN!

trollis76 06-02-2009 11:11 AM

RE: Adopts News
 
Quote:

Originally Posted by Saphira
WHO'S THE MAN!

Well... Not you, I guess. Since you're not a man and-
*Just kidding*

But wai- Are you a man? I just guessed by the name but... I might be wrong? Congratz, for solving this anyway.

Saphira 06-02-2009 11:29 AM

RE: Adopts News
 
I am male. Saphira is the name of my favourite fictional character of all time. She's the beautiful dragon from Eragon/Eldest/Brisingr. =P


All times are GMT -5. The time now is 11:28 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.