Mods Needed: Poster Desc. Editing, Comment deletion, Comment Blocking, and more. Mods Needed: Poster Desc. Editing, Comment deletion, Comment Blocking, and more.
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Mods Needed: Poster Desc. Editing, Comment deletion, Comment Blocking, and more.

Started by pgt96drvr, January 26, 2005, 10:19:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pgt96drvr

I am looking for a great freelancer, that I can trust.  My last bit of work was done by Nibbler, great guy.  I have many mods already, and hopefully can have something implemented that won't mess with what I have already done - but I don't see this as an issue.

As for a budget: Obviously I would liek to pay as little as possible, but I do have some money to spend and shouldn;t be an issue.

Mods I would like: (by the way, I have 1.2.1)

--Ability for a user to be able to "shut down" the ability for be to be able to post comments under their picture.
--Ability for a user to delete any comments that have been ut under their picture.
--Ability for a user to edit their pic description at any time (i see this is avail. on 1.3, but would like to keep 1.2.1)
--When a person posts a comment under a pic, it has a thumbnail next to their name and people can click on it and enlarge it so it's easily viewable)

I thik this will do for now.  I am sure that my users will like a lot more options, but I don;t want to scare any developers away :) ...  If someone can contact me @ lewiscbaker@yahoo.com, and give me more information, I'd love to here from you.  I am looking to establish a good relationship so I can come back to whoever helps and pay them for more mods.

BTW, one of the sites that need these mods is www.facesofwow.com .

Thanks, and I hope my expectations are not too high and that this can be accomplished.  Time really isn't a huge issue - better to have it done right and tested rather than rushed and bugged.

foulu

--Ability for a user to edit their pic description at any time (i see this is avail. on 1.3, but would like to keep 1.2.1)


major time !!!

pgt96drvr

Well...  I would like all at once...   but if someone just wants to do 1 at a time, that's allright as well...

The ones I would really like, ASAP, would be the option for people to delete commetns under their own pic and to disable comments under their own pic.

Thanks guys.

foulu


foulu

displayimage.php

find

function html_picture_menu($id)

add before

function html_picture_comment($id, $canrate)
{
    global $lang_display_image_php;

if ($canrate == 'YES') $st = $lang_display_image_php['dis_comment'];
elseif ($canrate == 'NO') $st = $lang_display_image_php['undis_comment'];
    return <<<EOT
<div align="center" class="admin_menu">
<a href="delete.php?id=$id&what=com" class="adm_menu" onclick="return confirm('{$lang_display_image_php['confirm_com']}');">{$st}</a></div>
EOT;
}

find

global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER, $HTTP_COOKIE_VARS;

of function html_picture()

and replace with

global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER, $HTTP_COOKIE_VARS, $USER_DATA;

find

$picture_menu = ((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';

add before

$result = db_query("SELECT owner_id, canrate from {$CONFIG['TABLE_PICTURES']} WHERE pid = '$pid' LIMIT 1");
    $nbEnr = mysql_fetch_array($result);
    $owner = $nbEnr['owner_id'];
    $canrate = $nbEnr['canrate'];
    mysql_free_result($result);

add below

if  ($owner == $USER_DATA['user_id']) $picture_menu .= html_picture_comment($pid, $canrate);

find

$result = db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id ASC");

add before

    $result = db_query("SELECT canrate,owner_id  from {$CONFIG['TABLE_PICTURES']}  WHERE approved = 'YES' AND pid = '$pid'");
    $nbEnr = mysql_fetch_array($result);
    $canrate = $nbEnr['canrate'];
    $owner = $nbEnr['owner_id'];
    mysql_free_result($result);

find

$tmpl_comments_buttons = template_extract_block($template_image_comments, 'buttons', '{BUTTONS}');

add below

$tmpl_comments_buttons_sp = template_extract_block($template_image_comments, 'buttons_sp', '');

find

$user_can_edit = (GALLERY_ADMIN_MODE) || (USER_ID && USER_ID == $row['author_id'] && USER_CAN_POST_COMMENTS ) || (!USER_ID && USER_CAN_POST_COMMENTS && ($USER['ID'] == $row['author_md5_id']));

replace with

$user_can_edit = (USER_ID == $owner) || (GALLERY_ADMIN_MODE) || (USER_ID && USER_ID == $row['author_id'] && USER_CAN_POST_COMMENTS ) || (!USER_ID && USER_CAN_POST_COMMENTS && ($USER['ID'] == $row['author_md5_id']));

find

$comment_buttons = $user_can_edit ? $tmpl_comments_buttons : '';

replace with

if (USER_ID == $owner) $comment_buttons = $user_can_edit ? $tmpl_comments_buttons_sp : '';
        else $comment_buttons = $user_can_edit ? $tmpl_comments_buttons : '';       

delete.php

find

function parse_select_option($value)

add before

function disable_comment($pid)
{
    global $USER_DATA;
    global $CONFIG, $lang_errors, $lang_delete_php;

    $query = "SELECT canrate, owner_id, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE pid ='$pid'";
    $result = db_query($query);
    if (!mysql_num_rows($result)) cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
    $pic_data = mysql_fetch_array($result);

    if (!($pic_data['owner_id'] == $USER_DATA['user_id'] )) {
        cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
    }
   
    if ($pic_data['canrate'] == 'YES')
    $query = "UPDATE {$CONFIG['TABLE_PICTURES']} SET canrate='NO' WHERE pid='$pid'";
    elseif ($pic_data['canrate'] = 'NO') $query = "UPDATE {$CONFIG['TABLE_PICTURES']} SET canrate='YES' WHERE pid='$pid'";
    $result = db_query($query);
    echo "<tr><td colspan=\"6\" class=\"tableb\">" . sprintf($lang_delete_php['pic_com_success'], $pic_data['filename']) . "</td></tr>\n";
}


find

    case 'album':

add before

    case 'com':
       $result = db_query("SELECT owner_id  from {$CONFIG['TABLE_PICTURES']}  WHERE approved = 'YES' AND pid = '$pid'");
       $nbEnr = mysql_fetch_array($result);
       $owner = $nbEnr['owner_id'];
       mysql_free_result($result);

        if (!($owner == USER_ID || USER_ADMIN_MODE)) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);

        $pid = (int)$HTTP_GET_VARS['id'];

        pageheader($lang_delete_php['mod_comment']);
        starttable("100%", $lang_delete_php['mod_comment'], 6);

     disable_comment($pid);
        if ($need_caption) output_caption();

        echo "<tr><td colspan=\"6\" class=\"tablef\" align=\"center\">\n";
        echo "<div class=\"admin_menu_thumb\"><a href=\"index.php\"  class=\"adm_menu\">$lang_continue</a></div>\n";
        echo "</td></tr>";
        endtable();
        pagefooter();
        ob_end_flush();
        break;

english.php

find

$lang_display_image_php = array(

add below

        'confirm_com' => 'Are you sure you want to DISABLE/UNDISABLE on this picture ?',
        'dis_comment' => 'DISABLE COMMENT', // add by kak
   'undis_comment' => 'ENABLE COMMENT', // add by kak

find
if (defined('DELETE_PHP')) $lang_delete_php = array(

add below

        'mod_comment' => 'Modify comment',
        'comment_deleted' => 'Comment was succesfully deleted',
   'pic_com_success' => 'Picture \'%s\' modify successful', // add by kak

theme.php

find

<!-- END buttons -->

add below

<!-- BEGIN buttons_sp -->
                                        <a href="delete.php?msg_id={MSG_ID}&what=comment"  onclick="return confirm('{CONFIRM_DELETE}');"><img src="images/delete.gif" border="0" align="absmiddle" ></a>
<!-- END buttons_sp -->

i dont note my change so i think i miss smt, if error plz post here





pgt96drvr


pgt96drvr

There was an error while processing a database query.


While executing query "SELECT owner_id, canrate from eqgallerypictures WHERE pid = '372' LIMIT 1" on 0

mySQL error: Unknown column 'canrate' in 'field list'


Notice: Constant SMILIES_PHP already defined in /hsphere/local/home/pgt96drv/eq2faces.com/gallery/include/smilies.inc.php on line 20



pgt96drvr

Ok...  the more I thought about it, the simpler the fix was...

Had to create a field (canrate) in the pictures table with YES, NO values, Default No.

Everything looks like it's working...

Am I correct in assuming that this mod only gives you the ability to delete comments posted under your own pic when logged in as that user?  There are a couple of other things that I need, but wow....  this will be a very huge help...  thanks!

Only a couple more mods left on my list, but this was by far the one that I needed the most...

/bow


pgt96drvr

I have noticed that an "Enable / Disable" Comment mod was also included in this...   though whenever soemone tries to change this setting, it says "User does not have permissions" (or soemthing to that effect).

Also, it seems as if it is taking much much much longer to bring up a picture that has 40+ comments and I kept getting memory errors because of the number of comments.  Ugh... 


foulu

user must be in admin mode to enable/disable comment

mod use 2/3 query so far (see debug).

pgt96drvr

mod use 2/3 query so far (see debug).    ???     ???

Also ...  Is there any way that the code can be altered so the user doesn't have to be in admin mode, just logged in? 

foulu

replace with this in delete.php

    case 'com':
       $result = db_query("SELECT owner_id  from {$CONFIG['TABLE_PICTURES']}  WHERE approved = 'YES' AND pid = '$pid'");
       $nbEnr = mysql_fetch_array($result);
       $owner = $nbEnr['owner_id'];
       mysql_free_result($result);

        if (!($owner == USER_ID)) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);

        $pid = (int)$HTTP_GET_VARS['id'];

        pageheader($lang_delete_php['mod_comment']);
        starttable("100%", $lang_delete_php['mod_comment'], 6);

     disable_comment($pid);
        if ($need_caption) output_caption();

        echo "<tr><td colspan=\"6\" class=\"tablef\" align=\"center\">\n";
        echo "<div class=\"admin_menu_thumb\"><a href=\"index.php\"  class=\"adm_menu\">$lang_continue</a></div>\n";
        echo "</td></tr>";
        endtable();
        pagefooter();
        ob_end_flush();
        break;


also, my mod only run 2 or 3 queries only -> cant slow or carsh your host/sever

pgt96drvr

Ok, I still get "  you do not have permission" ... 

I took "!" out of --->  if (!($owner == USER_ID)) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);

It still gave the option to me when I was the correct member...  and when everything looked liek it did before..  except when i clicked it again, it said that the modification has been made to the picture...  When I went back to the picture though, it still enabled me to post comments..  I clicked the option again, thinking that Disable, and Enable needed to be switched...  same thing..  said that it was modified, but enabled me to make comments.

Maybe I did not set up the new field in the database correctly. (canrate)


foulu

canrate enum('YES','NO') default NO

u still can comment if u are admin.

pgt96drvr

Nope, the field is right int he table...  Whenever I test, I use an account of one of the members... mmmm ....  wait...  I know what I didn't do ...  I logged in as the admin of the picture, changed the setting and then was stilla llowed to post....   I should log in.. change setting, and log in as someone else....  then test...  I'll let you know what results I get...

Thanks.

pgt96drvr

Ok latest update:

I changed settings from Enable to disable many times while attempting to comment as both the registered user and a diff. user...  every time it allowed to comment, even thoguh it stated that the picture was changed...  maybe it says it is makign the change, but I did not set up a different field...  I set up the canrate field.. is there another I should have set up?  At any rate.. Still not working.  :(

Also, I received an email from a member about not being able to delete comment under name...  I thought I tested it, but apparently that is nto working.  It's not due to alterations, because the other 2 sites that I have the mod on don't allow comment deletion by the pic owner either, and I haven't altered them at all..  I thoguht I tested it, but apparently not :(

Thanks for your help, and I appreciate your patience.  If you would liek to try to get this done a little easier, you can contact me on AIM = PGT96drvr or MSN = lewiscbaker@yahoo.com ...  we could post results in here later..

Once again, thanks for your help man... 

pgt96drvr

George_CC  is the best!  Please see him if you would like for him to complete some options like this for yourself.  I wish it were sinmply enough to just post the code, but there are so many snippets and on-the-fly alterations that were not documented.

This Request may now be closed if you wish.

Thanks George_CC !