Setting Validated A...
 
Notifications
Clear all

Setting Validated Author via bridge

6 Posts
2 Users
0 Reactions
1,858 Views
(@calash)
Posts: 180
Estimable Member
Topic starter
 

The next step I want to take in my site is to set permissions based on what vBulletin calls Bitfields.  The end result would be to allow me to set abilities based on groups (admins, mods, etc).

I have the checking part all set and done, however one thing I am having trouble with is finding a place to set if a user is a validated author.  For an admin or mod you can define there status in the get_session_variables.php file.  Where does the state of Validated author get set?

Thanks πŸ™‚


The World of Necrotania - Story Writing Community

 
Posted : 11/07/2008 6:51 pm
(@tammy)
Posts: 2577
Member Moderator
 

I don't believe it's ever set. It's checked only on the story submission page, so there it's just checked via a sql query.


 
Posted : 12/07/2008 12:25 pm
(@calash)
Posts: 180
Estimable Member
Topic starter
 

Ah, I did not check there.  I will have to take a look at the file.

That being the case what I want to do may not be possible using just the bridge files.

Thanks for the help Tammy πŸ™‚


The World of Necrotania - Story Writing Community

 
Posted : 12/07/2008 12:59 pm
(@tammy)
Posts: 2577
Member Moderator
 

You can set it the same way the others are in get_session_variables.php you just have to write it.


 
Posted : 15/07/2008 12:38 pm
(@calash)
Posts: 180
Estimable Member
Topic starter
 

I think I see how to do it.

The relevant bit of code from stories.php


$result = dbquery("SELECT "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname, "._EMAILFIELD." as email, validated FROM "._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_authorprefs as ap WHERE "._UIDFIELD." = '$uid' AND ap.uid = "._UIDFIELD." LIMIT 1");
$user = dbassoc($result);
$authorpenname = $user['penname'];
// validate fic, send story alerts, and mail admins
if(!$validated && ($autovalidate || $user['validated'] || $storyvalid == 2)) $validated = 1;
else if(!$validated) $validated = 0;
if($admin && USERUID != $uid) {
if($admincats && !sizeof(array_intersect( $catid, explode(",", $admincats)))) {
$output .= write_error(_NOTAUTHORIZEDADMIN."  "._TRYAGAIN);
return $output;
}
}

Could I set $validated in get_session_variables.php?  Or would I have to set $_POST['validated'] to fool the script into setting the correct state based on the bitfield code?

I know I could just alter stories.php, but I would like to try and keep my changes to the bridge files...just to keep things cleaner during upgrades.

I may play with it a bit and see if I can get it work.

Thanks for the guidance πŸ™‚


The World of Necrotania - Story Writing Community

 
Posted : 15/07/2008 11:25 pm
(@tammy)
Posts: 2577
Member Moderator
 

You just want to define it like isADMIN.  If you've included the authorprefs table  in your query for getting the user data in get_session_vars.php, it's already being pulled.


define("isValidatedAuthor", $userdata['validated'] ? true : false);

 
Posted : 16/07/2008 1:54 pm
Share: