Welcome to Geeklog Friday, September 25 2020 @ 10:26 pm EDT

Geeklog Forums

Edit button on stories for admins


jim

Anonymous
I liked the print and email buttons on the top of a story. I put my edit link up there to, but without a cool edit image it lost its look. So I changed line 410 in lib-common.php to add a template value {edit_icon}. It changed from this:
PHP Formatted Code


    if( SEC_hasAccess( $A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'] ) == 3 AND SEC_hasrights( 'story.edit' ))
    {
            $article->set_var( 'edit_link', '<a href="' . $_CONF['site_admin_url'] . '/story.php?mode=edit&sid=' . $A['sid'] . '">' . $LANG01[4] . '</a>' );
            $article->set_var( 'edit_icon', '<a href="' . $_CONF['site_admin_url'] . '/story.php?mode=edit&sid=' . $A['sid'] . '">' . '<img src= "' . $_CONF['layout_url'] . '/images/edit.gif" alt="edit" border=0>' . '</a>' );
    }
 
It's for my personal blog jimweller. I've posted a picture here.
PHP Formatted Code


    if( SEC_hasAccess( $A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'] ) == 3 AND SEC_hasrights( 'story.edit' ))
    {
            $article->set_var( 'edit_link', '<a href="' . $_CONF['site_admin_url'] . '/story.php?mode=edit&sid=' . $A['sid'] . '">' . $LANG01[4] . '</a>' );
            $article->set_var( 'edit_icon', '<a href="' . $_CONF['site_admin_url'] . '/story.php?mode=edit&sid=' . $A['sid'] . '">' . '<img src= "' . $_CONF['layout_url'] . '/images/edit.gif" alt="edit" border=0>' . '</a>' );
    }
 
 Quote

Status: offline

Ectropian

Forum User
Chatty
Registered: 19/06/02
Posts: 61
Would you care to elaborate on what else you had to do? i.e. editing theme files to remove the EDIT link at the bottom, or add to the headers, etc. By simply changing that one line in the lib-common.php , I have not been able to get 1 theme to actually change. Not to mention both of your "change this" and "to this" lines are exactly the same. Any suggestions?
--Ted(Ectropian)
 Quote

jim

Anonymous
The code is screwed to because I was testing a bug in geeklog where you can only use one CODE meta-tag. So I just used the same code snippet twice for testing. And then hit submit by accident. The moderators still posted it. Hah! I win!

So, here's the details. In your storytext.thtml file in the theme of your choice (geeklog/public_html/layout/yourtheme/storytext.thtm) add an {edit_icon} value where ever you like.

This is the original code from lib-common.php:

PHP Formatted Code

    if( SEC_hasAccess( $A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'] ) == 3 AND SEC_hasrights( 'story.edit' ))
    {
            $article->set_var( 'edit_link', '<a href="' . $_CONF['site_admin_url'] . '/story.php?mode=edit&sid=' . $A['sid'] . '">' . $LANG01[4] . '</a>' );
    }
 
And ended like shown above in the story. I only added one line that creates a variable that get's replaced by an image with a link.

This whole thing makes me think that the owner of a story should be able to modify it. My story up there is messed up and needs fixing. The owner and anybody in the story admin group should be able to modify it's content.

I'm doing this same thing to get a "read more" icon. I haven't posted the hack yet though.

 Quote

Status: offline

Ectropian

Forum User
Chatty
Registered: 19/06/02
Posts: 61
Thanks alot. This really looks so much better than the edit link at the bottom. I assume you remove the link for edit as well in the theme?

Problem I see with most of these hacks like this is that they need to be meticulously readded after each upgrade. I wonder if GL would consider encorporating this as a standard? Maybe I will add it to the wish-list Smile

I have created a neat edit icon for anyone who wishes to use it with this hack.


--Ted(Ectropian)
 Quote

All times are EDT. The time is now 10:26 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content