Adding a message for non-registered users Adding a message for non-registered users
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Adding a message for non-registered users

Started by dino bambino, September 13, 2007, 09:38:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dino bambino

I found something on another thread that kind of answers my question but I need just a little more guidance..

I have things sets so that only registered users can vote on images and I'd like to have a message that tells them that they need to register or login to take part in voting. The info on this thread
http://forum.coppermine-gallery.net/index.php?topic=45673.msg217262

gave me the basics but I can only get the text to display at the very top of the page. Can someone help guide me on how to add this so I can have message displaying under the image under the caption on displayimages.php?

I'm a bit of a newbie with PHP, getting better but still struggling.  Thanks!   

Nibbler

Add the following code into your theme's theme.php


function theme_html_rating_box()
{
    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $THEME_DIR;
    global $template_image_rating, $lang_rate_pic;
    global $REFERER;

    if (!(USER_CAN_RATE_PICTURES && $CURRENT_ALBUM_DATA['votes'] == 'YES')) return '<p align="center">You must <a href="register.php">register</a> or <a href="login.php?referer='.$REFERER.'">login</a> in order to vote</p>';

    $votes = $CURRENT_PIC_DATA['votes'] ? sprintf($lang_rate_pic['rating'], round($CURRENT_PIC_DATA['pic_rating'] / 2000, 1), $CURRENT_PIC_DATA['votes']) : $lang_rate_pic['no_votes'];
    $pid = $CURRENT_PIC_DATA['pid'];

    if (defined('THEME_HAS_RATING_GRAPHICS')) {
        $location= $THEME_DIR;
    } else {
        $location= '';
    }

    $params = array('{TITLE}' => $lang_rate_pic['rate_this_pic'],
        '{VOTES}' => $votes,
        '{RATE0}' => "ratepic.php?pic=$pid&amp;rate=0",
        '{RATE1}' => "ratepic.php?pic=$pid&amp;rate=1",
        '{RATE2}' => "ratepic.php?pic=$pid&amp;rate=2",
        '{RATE3}' => "ratepic.php?pic=$pid&amp;rate=3",
        '{RATE4}' => "ratepic.php?pic=$pid&amp;rate=4",
        '{RATE5}' => "ratepic.php?pic=$pid&amp;rate=5",
        '{RUBBISH}' => $lang_rate_pic['rubbish'],
        '{POOR}' => $lang_rate_pic['poor'],
        '{FAIR}' => $lang_rate_pic['fair'],
        '{GOOD}' => $lang_rate_pic['good'],
        '{EXCELLENT}' => $lang_rate_pic['excellent'],
        '{GREAT}' => $lang_rate_pic['great'],
        '{WIDTH}' => $CONFIG['picture_table_width'],
        '{LOCATION}' => $location,        //theme dir or default images directory
        );

    return template_eval($template_image_rating, $params);
}


You might want to style it a little.

dino bambino

You are my hero!  Thanks so much. It works perfectly!

chris.h

Thank you. Wanted something like this myself.  ;D

chris.h

This does indeed do the trick.

However the 'you must register' message then also appears if voting is dissallowed in a specific gallery, when users are allready logged in  - sending out a confused message to the user.  ???