Author Topic: [MOD] - Restrict users to use e-card and download if they have not voted first.  (Read 64578 times)

0 Members and 1 Guest are viewing this topic.

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
:cry: still no change (practically and visually)
are you meaning that even if you change manually the value in field details_vote_download_restriction_options on 4images_settings table (change 0 to 1 or 1 to 0), nothing happens?

well, i think the best way to make it work is to install the entire the mod, test it first and then after  you are sure it works, you can suppress or delete some features like protect lightbox or other...
ch€ri{Bi}²


Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Thanks for advising this. When I first coded this, I wondered if the $config string could of been used under the settings page as part of the general function that has just been corrected above.

Quote

are you meaning that even if you change manually the value in field details_vote_download_restriction_options on 4images_settings table (change 0 to 1 or 1 to 0), nothing happens?


I have tested this part as it should work even by replacement - either - manually or automatically from your ACP's configuration page. ;)

Offline john999

  • Pre-Newbie
  • Posts: 7
    • View Profile
I already doublechecked my code and still I´m getting this:

Code: [Select]
DB Error: Bad SQL Query: SELECT vote FROM VOTED_TABLE WHERE image_id =929 AND user_id =-1
Table 'john999.VOTED_TABLE' doesn't exist

This is just one of many, they differ only in the image ID.

What could be the reason for it?

I also execuded http://***.de/4images/install_rvotes.php and it said "success".


What did I miss?


Thx alot :)


€dit: http://www.4homepages.de/forum/index.php?topic=6123.0

Would this help? What Version should I take? A or B?
« Last Edit: May 16, 2006, 12:49:50 PM by john999 »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
I guess this mod is required [MOD] Votes saved in DB mod...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline john999

  • Pre-Newbie
  • Posts: 7
    • View Profile
Ok, I already installed that Mod. By executing this "voted_a_install.php" I got a new Table called "VOTED_TABLE"
-> The SQL Error vanished *surprise-surprise* ;)

Bad news: The Download Butten is still disabled after vote.

So I added also the changes named in "A".

After that I got again Errors, this time it mentioned:
Code: [Select]
DB Error: Bad SQL Query: SELECT vote FROM 4images_voted WHERE image_id =939 AND user_id =1
Table 'john999.4images_voted' doesn't exist

So I just copied "Voted_Table" to "4images_voted"
-> Errors vanished again

Bad news: The Button is still not enabeld.

In both Tables (4images_voted and VOTED_TABLE) no data is stored after a vote. Nor by guest, nor by registered user.
(BTW: As admin the Buttons are all the time activated.)

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Quote
Bad news: The Download Butten is still disabled after vote.
i forgot to mention : this mod requires version A of [MOD]Votes saved in DB
the two tables you are talking about are supposed to be the same table (4images_voted is the real name of the mysql table, VOTED_TABLE is a global variable used in PHP to make mysql queries...)

and if there is no data stored in VOTED_TABLE after some votes then  :? 
 :arrow: the present mod will never know who voted  and the button will always stay disabled
 :arrow: you made a mistake when you install [MOD]Votes saved in DB version A!! Try to re-install the complete mod  :wink:

 :!: admin accounts are not concerned by these restrictions, that's why admin will always have buttons enabled.

ch€ri{Bi}²


Offline john999

  • Pre-Newbie
  • Posts: 7
    • View Profile
Oh no, I am so an idiot...

I tested this as admin -> ok there it is always activated (of course ... why should the admin lock himselfe out ^^)
So I tested it, when I was logged out -> as Guest


But I did not tested it as a normal registered user logged in. <- There it works perfectly...data is stored in table and so on.


But now I am a little bit sad because I thougt this MOD would also allow Guests to Download after they have voted.
The Votes are counted, but there is no entry in the table (jeah I know, he has no UserID)

But maybe it is possible that the voting is saved by cookie/ip, so that this Guest can download the image after a vote.

Code: [Select]
if (!in_array($id, $split_list) && !in_array($id, $cookie_rated) && !$rated) {Thought that "$cookie_rated" was what I was searching :(

Any ideas how to implement that?

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Oh no, I am so an idiot...
hehe! you're welcome  :mrgreen:

But maybe it is possible that the voting is saved by cookie/ip, so that this Guest can download the image after a vote.
well you can use this mod to store a cookie when a user rates a pic... but...
 :arrow: you have to add extra code to verify the cookies in this mod
 :arrow: if it's a guest and if he deletes the cookie, he can vote again and again for the same picture :twisted:



Code: [Select]
if (!in_array($id, $split_list) && !in_array($id, $cookie_rated) && !$rated) {Thought that "$cookie_rated" was what I was searching :(

Any ideas how to implement that?
:?: where did you see this code ?
« Last Edit: May 16, 2006, 08:23:22 PM by ch€ri{Bi}² »
ch€ri{Bi}²


Offline john999

  • Pre-Newbie
  • Posts: 7
    • View Profile
The doublevoting isn´t that important. I just want to give them a chance to save the image :D


I´ll have a look at this MOD, but something tells me that won´t work at the first try ;)
Arghh you edited your post...
Quote
you have to add extra code to verify the cookies in this mod
... now I´m sure that I won´t manage it without help :([/color]

Maybe you could give me some advice how to verify cookies of guests (especially for my mod ^^)

Quote
where did you see this code ?
Found the Code here ... Step 1.2 (but I´m not an expert in PHP so I don´t know what it does)
Thx so far

Offline Ch*yeuk

  • Newbie
  • *
  • Posts: 27
    • View Profile
I can't find the code in STEP 2.5? I have version 1.7.2

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
I can't find the code in STEP 2.5? I have version 1.7.2
:? not sure this code come from the original script !!!

but it's not a problem   :arrow:  add the code at the very end of the file, before the final ?>  :wink:
ch€ri{Bi}²


Offline macmaster_it

  • Newbie
  • *
  • Posts: 10
    • View Profile
Hi all,
nice Mod. works well also with 4.Images 1.7.3.
But I must turn off this function, because I'm missing e massages to the user, that he must vote befor download....
Plaese make e change!! The button must be available and when you click them have to apear a pop-up-window...
otherwise you can give the info also when go with the mouse over the button (like e tooltip).
I not know how realize that, but maked like that it will be a great feature!!!

thank's a lot
ron.

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
you can give the info also when go with the mouse over the button (like e tooltip).
that's the method i use  8)
 :arrow: and you can make it by yourself with this help  :wink:
ch€ri{Bi}²


Offline Jetstream

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Fotogalerie Chris Gubelmann
Hi all

I have exatcly the same request as john999. I give the download right for all my pictures not only to users, but also to guest. For that reason, it is important for me that this mod works cookie based. Now that I have found the other mod who saves ratings in a cookie too, I am looking for the "extra code to verify the cookies" mentioned by ch€ri{Bi}². Now I am, just like john999, not the php expert and need help to realize that.

Who can help us?