Tutorial: edit listing from within the viewlisting page

Discussion in 'Tips & Tricks' started by performancecentral, Feb 15, 2013.

  1. Hi all,
    Nothing too complex here, but I thought it could be very helpful if you were browsing and noticed you needed to make an edit to a listing.

    All you need to do is find a nice spot for this code. What it will do is create a URL called "Edit Listing" which is only visible to the logged in administrator. It will take you directly to the administration page with that particular listing id open.

    Code:
    {* Are you an administrator? *}
        {dynamic}
        {if $smarty.session.userlevel==1}
        <div align="center">
        <a href="http://www.performancecentral.com.au/administration/listings.php?view={$lid}"/> Edit Listing </a>
        </div>
        {/if}
        {/dynamic}
  2. freeze2 Super Moderator

    This is nice for an administrator to be able to access the admin from the listing page. If you want to take it a step further, you can allow an adminstrator access to the listing via the admin as shown above, as well, by modifying the code slightly, you can allow the user access to modify their listing with a direct link to the "usermodifylisting.php" as well.

    Code:
    {if $smarty.session.userlevel==1}
    <div><a href="administration/listings.php?l_ID={$view}" target="_blank">Edit This Listing</a></div>
    {elseif $smarty.session.username == $username}
    <div><a href="usermodifylisting.php?view={$lid}">Edit This Listing</a></div>
    {else}
    {/if}
    
  3. Awesome addition. Thanks heaps for that Love your work mate. Really impressed

Share This Page