Author Topic: Display message to unregistered users  (Read 8222 times)

0 Members and 1 Guest are viewing this topic.

Offline haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Display message to unregistered users
« on: February 25, 2011, 10:54:50 AM »
hi ..i want to add a message to my download button for unregistered users..

download button is fine..what i mean to say when unregistered or guest clicks the download button it shows message to the user to register or login ..

its ok if it redirects to another page..and it will be alot better if its possible to display message box like using javascript
alert.messagebox kind of thing..

Any one any ideas how to do that..

Actually today one of user asked me how to download file.. i cant download file when i click download.. and there i told him that you need to register..

so what i mean to say, all users are not good with computers.. it will be better to display user their error that why they can not download files..that they need to register or login to able to download..


Help and responses needed...If there is any mod out here for this purpose..will b great to hear about that.


Kind Regards
Haider

Rembrandt

  • Guest
Re: Display message to unregistered users
« Reply #1 on: February 25, 2011, 12:36:21 PM »
H!

here can you see the effect Demo

1.) create a new file call it "please_reg.html" and store in your templates folder.
Code: [Select]
{header}
<div align="center"><b>{lang_please} <a href="{url_register}" target="_blank" onClick="window.close()">{lang_plr_register}</a> {lang_plr_or} <a href="{url_login}" target="_blank" onClick="window.close()">{lang_login}</a></b></div>
{footer}

2.) search in includes/functions.php:

if (!check_permission("auth_sendpostcard"$image_row['cat_id'])) {

and insert above:

  
if ((!check_permission("auth_download"$image_row['cat_id'])) && $user_info['user_level'] == GUEST) {
    
$download_button "<a href=\"".ROOT_PATH."index.php?template=please_reg\" onclick=\"void(window.open(this.href,this.target,'width=300px,height=150px,top=200px,left=500px,resizable=0,menubar=no,locationbar=no,scrollbars=auto'));return false;\"><img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" /></a>";
    
$download_zip_button "<a href=\"".ROOT_PATH."index.php?template=please_reg\" onclick=\"void(window.open(this.href,this.target,'width=300px,height=150px,top=200px,left=500px,resizable=0,menubar=no,locationbar=no,scrollbars=auto'));return false;\"><img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" /></a>";
    
$allow_download 0;
    
clear_download_token($image_row['image_id']);
  }

    
$site_template->register_vars(array(
    
"lang_please" => $lang['please'],
    
"lang_plr_or" => $lang['plr_or'],
    
"lang_plr_register" => $lang['plr_register']
    ));


3.) search in lang/yourLang/main.php:

//--- Misc --------------------------------------------
//-----------------------------------------------------

insert below:
(deutsch)

$lang
['please'] = "Bitte";
$lang['plr_or'] = "oder";
$lang['plr_register'] = "Registrieren"

(english)

$lang
['please'] = "Please";
$lang['plr_or'] = "or";
$lang['plr_register'] = "Register";


that's all...

 mfg Andi
« Last Edit: February 26, 2011, 05:11:00 PM by Rembrandt »

Offline haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: Display message to unregistered users
« Reply #2 on: February 25, 2011, 03:03:50 PM »
 Many Many Many Many Superb THanks..

with little modifications..now it is looking good..

Many THanks for helping.. It is working awesome with your help..

i did little modification from
http://www.sohtanaka.com/web-design/inline-modal-window-w-css-and-jquery

and now its looking pretty..

Here is my site. you can see changes.

http://cusitlibrary.com/details.php?image_id=65

THanks again..

Keep Rocking..


--------------------------------------------------------------------

Oh.. i just found out ..the modifications it did dont work in old internet explorers..it is working fine on google chrome and firefox..
now trying to figure our a way to fix it for internet explorer..

is there any way to show your way if user is using internet explorer..and show this my modification..
« Last Edit: February 25, 2011, 03:56:30 PM by haider512 »

Rembrandt

  • Guest
Re: Display message to unregistered users
« Reply #3 on: February 25, 2011, 06:06:54 PM »
hm..
test it, in functions.php:

$download_button 
"<a href=\"".ROOT_PATH."index.php?template=please_reg?w=350\" rel=\"popup1\" class=\"poplight\" ><img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" /></a>";
$download_zip_button "<a href=\"".ROOT_PATH."index.php?template=please_reg?w=350\" rel=\"popup1\" class=\"poplight\" ><img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" /></a>";


and the html:
Code: [Select]
{header}
<div align="center" id="popup1" class="popup_block"><b>Please <a href="{url_register}" target="_blank" onClick="window.close()">{lang_register}</a> or <a href="{url_login}" target="_blank" onClick="window.close()">Login</a></b></div>
{footer}

Offline haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: Display message to unregistered users
« Reply #4 on: February 26, 2011, 07:06:44 AM »
no it didnt work :-(

will it work if i use this in funtions.php
Code: [Select]
<!--[if lt IE 9]>
        //your code here.. All IE browsers below 9 version will get your previous code.
<![endif]-->

<![if !IE]>
         //Your code with the pretty modifications..work in browsers other then IE..
<![endif]>


If you have more suggesstions please tell..and will this work if i use it in functions.php??

==========================================

EDIT :

Hmmm..not working..that only works in html..so i googled and found this..

     if ( eregi("MSIE"getenv"HTTP_USER_AGENT" ) ) || eregi("Internet Explorer"getenv("HTTP_USER_AGENT" ) ) ) {
  
// do something

}


but with this i can echo only.. if i use the download button code or anything. i get an error on IE?

is there anything in PHP which i can use like

if internet explorer

execute code 1

else

execute code 2


is it possible in php??

=============================================

EDIT 2 :

ok..i did this now and it some how worked..but having little issue with it??


     if ( eregi("MSIE"getenv"HTTP_USER_AGENT" ) ) || eregi("Internet Explorer"getenv("HTTP_USER_AGENT" ) ) ) {
  
// do something

  
echo "<h5>This is IE</h5>";

}

else {
	
 echo 
"<h5>This is not IE</h5>";
	
}



but there is some problem..in IE the message appears 3 times like this.

and browser other then ie it echos the message 4 times??

what to do it dont do looping thing??

=======================================

Edit 3 :

Wow awesome Superb..superb..

i did this and its working ..

     if ( eregi("MSIE"getenv"HTTP_USER_AGENT" ) ) || eregi("Internet Explorer"getenv("HTTP_USER_AGENT" ) ) ) {
  
// If User is using IE this statements will be executed

    
if ((!check_permission("auth_download"$image_row['cat_id'])) && $user_info['user_level'] == GUEST) {
    
$download_button "<a href=\"".ROOT_PATH."index.php?template=please_reg\" onclick=\"void(window.open(this.href,this.target,'width=300px,height=150px,top=200px,left=500px,resizable=0,menubar=no,locationbar=no,scrollbars=auto'));return false;\"><img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" /></a>";
    
$download_zip_button "<a href=\"".ROOT_PATH."index.php?template=please_reg\" onclick=\"void(window.open(this.href,this.target,'width=300px,height=150px,top=200px,left=500px,resizable=0,menubar=no,locationbar=no,scrollbars=auto'));return false;\"><img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" /></a>";
    
$allow_download 0;
    
clear_download_token($image_row['image_id']);
  }
}

else {
     
// else statement will be executed if it is not IE.

	
 if ((!
check_permission("auth_download"$image_row['cat_id'])) && $user_info['user_level'] == GUEST) {
    
$download_button "<a href=\"#?w=350\" rel=\"register_please\" class=\"poplight\" ><img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" /></a>";
    
$download_zip_button "<a href=\"#?w=520\" rel=\"register_please\" class=\"poplight\" ><img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" /></a>";
    
$allow_download 0;
    
clear_download_token($image_row['image_id']);
  }
	
}


its working awesome.. if user use the IE the code with your procedure will appear.. and if user uses browser other then IE the code appear to user will be yours but modified jquery one..

Its really kool cuz now both users of IE and Non IE can get benefited from this feature.. kool haan..

Many THanks.. i couldnt do this without your help..Many thanks..

Now its working.. I think you should introduce it as your mod.. :-)

May b users like this mod..i liked it very much as it give ease to users in using my site..
Now gonna apply it to my site.. it worked on wamp localhost so far..now gonna apply on my site. :-)
« Last Edit: February 26, 2011, 08:17:00 AM by haider512 »

Rembrandt

  • Guest
Re: Display message to unregistered users
« Reply #5 on: February 26, 2011, 07:13:35 PM »
...Now its working.. I think you should introduce it as your mod...

done  http://www.4homepages.de/forum/index.php?topic=29171.0   :D

mfg Andi