close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

User Admin Pages - Need to Add a Button

Thread began 3/22/2013 10:43 am by greg401801 | Last modified 3/26/2013 11:49 am by Jason Byrnes | 1942 views | 6 replies |

greg401801

User Admin Pages - Need to Add a Button

I used SecurityAssist to create a double opt-in registration system. In my testing, all works as expected. I haven't gone live yet, but I expect it to work.

Then I used DataAssist to create my User Admin pages. They seem to work just fine too. So far so good. I have added a UserLevel field to my db. I want to create a page that my employees who have basic admin level access can use to update a registered users UserLevel.

For example, when registering the user is automatically assigned a UserLevel of 0. After we review his credentials we want to go to the Admin section of our site, use the Search page to find this particular user, make a determination that they are eligible to be upgraded to another UserLevel - say Level 1 - and then initiate a routine that will set their UserLevel to 1 and automatically send them an email notifying them that they can now access protected content.

In the Double Opt-in tutorial there are directions for accomplishing the email task described. It also describes how to change the UserLevel in the same process. What I need are directions to add a button to the users_results.php page that was created by DataAssist to initiate this process. There are currently three buttons on this page:

One takes you to the user_results.php page
One take you to the users-details.php page
One deletes the record

I want to add a fourth button that will take me or my people to a new page that I will create called users_upgrade_userlevel.php. On this page I will simply change a users level from 0 to 1, or 1 to 2, etc. and click Submit. After clicking the UserLevel will be updated, the email will be sent, and the Admin person will be returned to the users_results.php page.

So, to summarize:

If I follow the steps in Double Opt-in tutorial, will I be able to accomplish the task of updating the UserLevel and sending the email?

What steps do I take to add a button to take me to the Update UserLevel page?

Sign in to reply to this post

Jason ByrnesWebAssist

Some of the concepts for the Double Opt in tutorial will apply, but not exactly.

the link to the users details page will pas the user ID as a query sting, for example:

users-details.php?ID=33

pass that same query string to the update userlevel page:

<href ="update-users-level.php?ID=<?php echo(isset($_GET['ID'])?$_GET['ID']:""); ?>">Update User Level</a>

on this page, you can create a recordset that queries the users table and filters the ID based on the ID URL variable, it will be the same type of recordset shown on the details page.

using this recordset, you show the existing user level.

add a form with a select list of user levels and a hidden element. the hidden element will use the ID column from the recordset as the value, add another hidden element to use the email column as the value.

you can then add an update record behavior. set the key column to the ID column, set the key value to the ID hidden element.

on the bindings panel, bind the user level to the select list.

then add the universal email behavior. Bind the To Address to the email hidden element.

Sign in to reply to this post

greg401801

Thank you for your quick reply. Considering I am a newb, what you wrote kinda looks like words I understand, but it will take some effort to accomplish your directions.

But I'm game. I'll do my best to work through all you recommended. When/if I have difficulty I'll get back to you.

Thanks. It could be a long weekend.....

Sign in to reply to this post

greg401801

OK. I've tried all kinds of stuff to try to make this work. It is not working. So I'm going to try to make it simple for me. It may not actually be simple, but I am going to try.

There are 3 buttons on the user_results.php page. When I go digging into the code I see the following when I select the buttons:

<td class="WADAResultsEditButtons" nowrap="nowrap">
<input type="button" class="formButton ResultsPageButton unstyled DetailButton" id="sprytrigger1" onclick="document.location.href='users_detail.php?UserID=<?php echo($row_WADAusers['UserID']); ?>
<?php echo(isset($_GET["pageNum_WADAusers"])?"&pageNum_WADAusers=".intval($_GET["pageNum_WADAusers"]):""); ?>';" value=""/>

<input type="button" class="formButton ResultsPageButton unstyled UpdateButton" id="sprytrigger2" onclick="document.location.href='users_update.php?UserID=<?php echo($row_WADAusers['UserID']); ?>
<?php echo(isset($_GET["pageNum_WADAusers"])?"&pageNum_WADAusers=".intval($_GET["pageNum_WADAusers"]):""); ?>';" value=""/>

<input type="button" class="formButton ResultsPageButton unstyled DeleteButton" id="sprytrigger4" onclick="document.getElementById('WADADeleteRecordID').value=<?php echo($row_WADAusers['UserID']); ?>;document.getElementById('deleteBox').style.display = 'block';document.getElementById('deleteMessage').style.display = 'table';" value="" />

</td>


Now, I want to add another button inline with these three. I succeeded in doing a copy/paste and caused a new button to appear. But that doesn't do me any good since I need the rest of the code to make that button do what it is supposed to do. So my first question is, how do I add a fourth button?

I want this button, when clicked, to go to a new page: users_update_userlevel.php. I know it has to pass the user ID, etc. I'm still unclear where I went wrong in trying to accomplish this. As I said, I'm a newb.

If you can tell me how to accomplish this task I can try to do the next steps - add the form elements, update the record and get the email functionality to work.

For now, can you please give me some simpler (more detailed) advice on how to add the button that takes me to the new page? Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

add the button inside a link tag:
<href ="update-users-level.php?ID=<?php echo(isset($_GET['ID'])?$_GET['ID']:""); ?>"><input type="button" name="updateUserLevel" id="updateUserLevel" value="Update User Level" /></a>

Sign in to reply to this post

greg401801

I copied the code and attempted to use it several ways. I was unsuccessful. First, I copied it as is. I pasted it between the second and third buttons. Here's what my code looks like:

<td class="WADAResultsEditButtons" nowrap="nowrap">
<input type="button" class="formButton ResultsPageButton unstyled DetailButton" id="sprytrigger1" onclick="document.location.href='users_detail.php?UserID=<?php echo($row_WADAusers['UserID']); ?>
<?php echo(isset($_GET["pageNum_WADAusers"])?"&pageNum_WADAusers=".intval($_GET["pageNum_WADAusers"]):""); ?>';" value=""/>

<input type="button" class="formButton ResultsPageButton unstyled UpdateButton" id="sprytrigger2" onclick="document.location.href='users_update.php?UserID=<?php echo($row_WADAusers['UserID']); ?>
<?php echo(isset($_GET["pageNum_WADAusers"])?"&pageNum_WADAusers=".intval($_GET["pageNum_WADAusers"]):""); ?>';" value=""/>

<href ="update-users-level.php?ID=<?php echo(isset($_GET['ID'])?$_GET['ID']:""); ?>"><input type="button" name="updateUserLevel" id="updateUserLevel" value="Update User Level" /></a>

<input type="button" class="formButton ResultsPageButton unstyled DeleteButton" id="sprytrigger4" onclick="document.getElementById('WADADeleteRecordID').value=<?php echo($row_WADAusers['UserID']); ?>;document.getElementById('deleteBox').style.display = 'block';document.getElementById('deleteMessage').style.display = 'table';" value="" />

</td>


The button appeared on my dreamweaver page, but when I saved the page and clicked "Preview in ___" it didn't show up in the browser. I tried both Safari and Firefox.

When I use Dreamweaver's "Live View" the button DOES show up. However, when I click the button nothing happens. Well actually, what happens is a large chunk of code is highlighted - nearly 100 lines. The highlighted code starts with the </a> tag in the following:

<div class="WADAResultsContainer">
<a name="top" id="top"></a>
<?php if ($totalRows_WADAusers > 0) { // Show if recordset not empty ?>


and the highlight ends just before the last </div> tag below.

<div class="WADANoResults">
<div class="WADANoResultsMessage">No Results Found</div><wa:insertbutton>
<div>
<input type="button" value="Insert" class="formButton unstyled" id="Insert" name="Insert" onclick="document.location.href='plugins/users_insert.php';" />
</div></wa:insertbutton>
</div>
<?php } // Show if recordset empty ?>
</div>

I also tried placing the code for the button before the three buttons. I tried surrounding it with td tags.

I'm obviously doing something just a little off. Again, the button shows up in Live View but does not show up in the browser.

Any thoughts on what I am doing wrong?

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...