Advanced search  

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

Pages: [1]   Go Down

Author Topic: Adding a message for non-registered users  (Read 3733 times)

0 Members and 1 Guest are viewing this topic.

dino bambino

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Adding a message for non-registered users
« on: September 13, 2007, 09:38:29 pm »

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!   
« Last Edit: September 13, 2007, 10:14:35 pm by Nibbler »
Logged

Nibbler

  • Guest
Re: Adding a message for non-registered users
« Reply #1 on: September 13, 2007, 10:02:50 pm »

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

Code: [Select]
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.
Logged

dino bambino

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Adding a message for non-registered users
« Reply #2 on: September 13, 2007, 10:13:51 pm »

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

chris.h

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 38
    • Zookx Design
Re: Adding a message for non-registered users
« Reply #3 on: October 17, 2007, 04:16:52 pm »

Thank you. Wanted something like this myself.  ;D
Logged

chris.h

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 38
    • Zookx Design
Re: Adding a message for non-registered users
« Reply #4 on: October 25, 2007, 06:04:33 pm »

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.  ???
Logged
Pages: [1]   Go Up
 

Page created in 0.028 seconds with 19 queries.