Auto submit story on submit step 3 for god only

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-12-2009, 04:13 AM
Casual Pligger
 
Join Date: Apr 2008
Posts: 38
I have created a snippet that contains php and JavaScript code. The code will auto submit stories on submit step 3 page (preview). The problem is that I only want this auto submit for god users, not for normal users. How do I modify the code so that the JavaScript only works for god?

{php}
echo "<script>submitEdgeStory();</script>";
{/php}

The submitEdgeStory(); will automatically "push" the submit button on submit step 3 page (the preview page) for ALL users, but I want it to only automatically submit stories for the god user.

Maybe there will be a way to combine the code above and the php script that disable submits for non-god users. This code will disable the normal users to submit stories and only let god submit an url at submit step 1 page. Maybe the first problem will be solved using this code together with the first one?

{php}
// require user to log in
force_authentication();

// restrict access to god only
$canIhaveAccess = 0;
$canIhaveAccess = $canIhaveAccess + checklevel('god');

if($canIhaveAccess == 0){
header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
die();
}
{/php}
Reply With Quote
  #2 (permalink)  
Old 05-12-2009, 02:59 PM
Casual Pligger
 
Join Date: Apr 2008
Posts: 38
Quote:
Originally Posted by gnalkit View Post
I have created a snippet that contains php and JavaScript code. The code will auto submit stories on submit step 3 page (preview). The problem is that I only want this auto submit for god users, not for normal users. How do I modify the code so that the JavaScript only works for god?

{php}
echo "<script>submitEdgeStory();</script>";
{/php}

The submitEdgeStory(); will automatically "push" the submit button on submit step 3 page (the preview page) for ALL users, but I want it to only automatically submit stories for the god user.

Maybe there will be a way to combine the code above and the php script that disable submits for non-god users. This code will disable the normal users to submit stories and only let god submit an url at submit step 1 page. Maybe the first problem will be solved using this code together with the first one?

{php}
// require user to log in
force_authentication();

// restrict access to god only
$canIhaveAccess = 0;
$canIhaveAccess = $canIhaveAccess + checklevel('god');

if($canIhaveAccess == 0){
header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
die();
}
{/php}
Ok, the problem is solved! If I use this code as a Snippet then Pligg will automatically push the submit button at the end of the submit _step_3 page (the preview page) only for god:

{if isset($isgod) && $isgod eq 1}
{literal}<script>submitEdgeStory();</script>{/literal}
{/if}

As simple as that!
Reply With Quote
  #3 (permalink)  
Old 10-13-2009, 08:47 AM
New Pligger
Pligg Version: 1.0.0
 
Join Date: Oct 2009
Posts: 17
How to do this for normal user?
Reply With Quote
Reply

Tags
javascript, php, snippet, submit, submit step 3

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
submit story step 3 question VLJ Questions and Comments 0 05-14-2007 08:00 PM
MYSQL Syntax in story submit, step 2 mbs348 Questions and Comments 17 05-10-2007 10:28 PM
how to get rid of step 1 of 'submit story'? mhk Questions and Comments 5 09-27-2006 02:17 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development