vBulletin Coupons [Deleted]

Status
Not open for further replies.

ChrisTERiS

Participant
Joined
Jan 16, 2015
Messages
73
ChrisTERiS submitted a new resource:

Coupons - Groupon clone

I'm offering my hard work for free, without even a single copyright line in footer, expecting that some of you will appreciate the time that I spent for coding it and they will donate something.
1.- How it works
  • Depending on his usergroup permissions a user can post a discount coupon for a product or service. He can set the discount percentage which appears in a nice way in the frontend to attract members.
  • Members of your site...
Read more about this resource...
 

LenKaiser

Participant
Joined
Nov 3, 2016
Messages
76
Hey Chris got another one for you :) Getting this PHP error when I go into my profile and click on the coupon links, My Coupons etc.

Code:
PHP Warning: Illegal string offset 'pm_messagelist' in ..../includes/class_core.php(4684) : eval()'d code on line 146

PHP Warning: Illegal string offset 'pm_newpm' in ..../includes/class_core.php(4684) : eval()'d code on line 151

PHP Warning: Illegal string offset 'pm_trackpm' in ..../includes/class_core.php(4684) : eval()'d code on line 152

PHP Warning: Illegal string offset 'pm_editfolders' in ..../includes/class_core.php(4684) : eval()'d code on line 153

PHP Warning: Illegal string offset 'substhreads_editfolders' in ..../includes/class_core.php(4684) : eval()'d code on line 169

PHP Warning: Illegal string offset 'profile' in ..../includes/class_core.php(4684) : eval()'d code on line 180

PHP Warning: Illegal string offset 'profilepic' in ..../includes/class_core.php(4684) : eval()'d code on line 183

PHP Warning: Illegal string offset 'avatar' in ..../includes/class_core.php(4684) : eval()'d code on line 190

PHP Warning: Illegal string offset 'signature' in ..../includes/class_core.php(4684) : eval()'d code on line 197

PHP Warning: Illegal string offset 'privacy' in ..../includes/class_core.php(4684) : eval()'d code on line 204

PHP Warning: Illegal string offset 'password' in ..../includes/class_core.php(4684) : eval()'d code on line 216

PHP Warning: Illegal string offset 'options' in ..../includes/class_core.php(4684) : eval()'d code on line 217

PHP Warning: Illegal string offset 'ignorelist' in ..../includes/class_core.php(4684) : eval()'d code on line 232

PHP Warning: Illegal string offset 'buddylist' in ..../includes/class_core.php(4684) : eval()'d code on line 247

PHP Warning: Illegal string offset 'event_reminders' in ..../includes/class_core.php(4684) : eval()'d code on line 252

PHP Warning: Illegal string offset 'attachments' in ..../includes/class_core.php(4684) : eval()'d code on line 262

PHP Warning: Illegal string offset 'deleteditems' in ..../includes/class_core.php(4684) : eval()'d code on line 276

PHP Warning: Illegal string offset 'moderateditems' in ..../includes/class_core.php(4684) : eval()'d code on line 314

PHP Warning: Illegal string offset 'newitems' in ..../includes/class_core.php(4684) : eval()'d code on line 367
 

ChrisTERiS

Participant
Joined
Jan 16, 2015
Messages
73
Hello,

Nice to see you here :) .... What vB and PHP versions are you running?

Chris
 

ChrisTERiS

Participant
Joined
Jan 16, 2015
Messages
73

LenKaiser

Participant
Joined
Nov 3, 2016
Messages
76
I have Coupons, Media Gallery & Video Club of yours installed. It actually maybe better if you logged into my site to see the problem. Let me know if you will need a login. PHP 7? Hmmmmm maybe that is my issue? I haven't upgraded to that.
 

ChrisTERiS

Participant
Joined
Jan 16, 2015
Messages
73
Open product-mediagallery.xml and search for:
Code:
$templater->register('userinfo', $userinfo[userid]);
Must has a double slash before (//). If not add it to be like:
Code:
//$templater->register('userinfo', $userinfo[userid]);
 

ChrisTERiS

Participant
Joined
Jan 16, 2015
Messages
73
do the same search (and replace if needing) for product-videoclub.xml
 

ChrisTERiS

Participant
Joined
Jan 16, 2015
Messages
73
Is it a testing or live site? If it's a testing then try to disable all than coupons and check. Most probably it will works. Then try activating one by one.
That's the only way to see where the bug occures. Is not a PHP 7 error as I was with PHP 5.6 till yesterday morning. It's only a day that I've PHP 7.
 

LenKaiser

Participant
Joined
Nov 3, 2016
Messages
76
There are no coupons listed on it yet. I'm still in production before I make the site public. So there are no members other than myself and my undeletable admin account.
 

ChrisTERiS

Participant
Joined
Jan 16, 2015
Messages
73
There are no coupons listed on it yet. I'm still in production before I make the site public. So there are no members other than myself and my undeletable admin account.
Then PM vB admincp access with permissions to Enable/Disable plugins and tomorrow morning I can make a check for you. If I remember well you're in USA so at that time you'll be dreaming that you're a rich man who does not knows how to spend his money :)
 

LenKaiser

Participant
Joined
Nov 3, 2016
Messages
76
LOL yep I'm in the US. Yeah its late where you are. No problem will send the info over in a bit. :)
 

LenKaiser

Participant
Joined
Nov 3, 2016
Messages
76
Revisiting this, anyone have any idea about how to fix this? I can give you a login if you need it.
 

niho

Aspirant
Joined
Jan 19, 2020
Messages
17
vbulletin version: 4.2.5
PHP version: 7.4


Hello Chris,

Hello helpful friends,

I will use this Coupons 1.0.0 product only for the benefit of the members, but I am having a minor problem. I think there is the problem of converting from unix time stamp to date.

Could there be an error in the code below?

"time left" does not appear.

coupons_categories_bit in product-coupons.xml

Code:
<td colspan="2" align="center" style="padding-left:5px; padding-top:5px;">
                    {vb:var vbphrase.coupons_time_left}: <b><span id="item{vb:raw id}" data-time="{vb:raw expires}" class="timeleft"></span></b>
                </td>
When I change this code as below,

Code:
<td colspan="2" align="center" style="padding-left:5px; padding-top:5px;">
                    {vb:var vbphrase.coupons_time_left}: <b><span id="item{vb:raw id}" data-time="{vb:raw expires}" class="timeleft"></span></b>{vb:raw expires}
                </td>
So when I just add the following code:

Code:
{vb:raw expires}
Time Left appears but not as a date. It looks like this:

Time Left:
1579463520


I will be glad if you can help.
 

ChrisTERiS

Participant
Joined
Jan 16, 2015
Messages
73
Hello,

Expiration date has been coded to work with a countdown jquery script, that's why there is no
Code:
{vb:raw expires}
This jquery script needs the expiration date in unix timestamp.

As I can see you changed the code. In this case the expiration date should be refresh only on page refresh. To change the expiration date in human view you must edit coupons.php

Search for 3 instances of:
Code:
$templater->register('expires', $coupon[ends]);
Lines: 202, 504, 713

Replaces those 3 lines with:
Code:
$templater->register('expires', date($vbulletin->options[coupons_dateview],$coupon[ends]));

Also change your template code:

From:
Code:
<td colspan="2" align="center" style="padding-left:5px; padding-top:5px;">
   {vb:var vbphrase.coupons_time_left}: <b><span id="item{vb:raw id}" data-time="{vb:raw expires}" class="timeleft"></span></b>{vb:raw expires}
</td>
To:
Code:
<td colspan="2" align="center" style="padding-left:5px; padding-top:5px;">
   {vb:var vbphrase.coupons_time_left}: <b>{vb:raw expires}</b>
</td>
 

niho

Aspirant
Joined
Jan 19, 2020
Messages
17
@Hello Chris,

Thank you for your help. However, there is still the following problem:

I applied all the changes you wrote. The "Time Left" date and time appear fixed on the coupons page but do not work as a countdown timer.
 

ChrisTERiS

Participant
Joined
Jan 16, 2015
Messages
73
As long as you changed the datetime format that's normal. As I wrote before, this script to work, need the expiration date in unix timestamp.

Just for curiously. Why you want the change the original code? Countdown didn't worked? Nobody reported something like this.
 

niho

Aspirant
Joined
Jan 19, 2020
Messages
17
As long as you changed the datetime format that's normal. As I wrote before, this script to work, need the expiration date in unix timestamp.

Just for curiously. Why you want the change the original code? Countdown didn't worked? Nobody reported something like this.
Hello Chris;

Thank you for your interest and support.

Actually, I don't want to change the original code. No information was visible in the countdown section, Time left:. Neither date nor time. Therefore, I needed to change the code. The same problem exists in the expires fields on pages like coupons_usercp.php?do=mycoupons and coupons_usercp.php?do=myorders&action=1. There are no expires there either. I will try to use your support here for those parts. I am using vbulletin version 4.5 and PHP version 7.4

Actually, I made another code change. The reason for this code change and the changed code was:

Error code:

Code:
Cannot use object of type mysqli_result as array on line 218 in /home/XXXXXX/public_html/coupons_usercp.php
#0 {main}
Related codes: usercp.php code lines 213-225:

Code:
 if ($itemid != 0)
        {
           // Find Item
           $item = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "coupons_items WHERE id=$itemid LIMIT 1");
           // Who is the owner?
           $owner = $item["userid"];
           // Check if active user is the owner or if he has moderator permissions
           if(($owner != $vbulletin->userinfo['userid']) AND (!($permissions["coupons"] & $vbulletin->bf_ugp["coupons"]["moderate"])))
           {
               // Check failed. Send him back
               print_no_permission();
           }
        }
This error was fixed when I replaced the X code below with the Y code.

X Code:
usercp.php code line: 213

Code:
if ($itemid != 0)
Y Code:

Code:
if (is_array($itemid != 0))
So I had to make these changes myself because I thought I couldn't find anyone to help. If I can make it work in its original form, this will make me very happy.
 
Status
Not open for further replies.
Top