Osclass Support Forums

Osclass plugin support => User Rating Plugin => Topic started by: Macreus on August 04, 2021, 11:15:32 PM

Title: Latest version failing to get user on public profile
Post by: Macreus on August 04, 2021, 11:15:32 PM
Hi, on public profile page, clicking on the user rating returns "User has not been recognized"

I think this is because the code is getting the item_id on every single function, and there is no item_id to retrieve on the public profile page, so the '&&' returns false.

Any solution? Thanks
Title: Re: Latest version failing to get user on public profile
Post by: Macreus on August 04, 2021, 11:39:12 PM
This is the code in the user-public-profile.php

Code: [Select]
         <?php if(function_exists('ur_show_rating_stars') && osc_user_id() > 0) { ?>
            <span class="ur-fdb">
<span class="strs"><?php echo ur_button_stars(); ?></span>
<br>
              <span class="lnk"><?php echo ur_button_add(); ?></span>
            </span>
          <?php ?>

Which looks like (https://i.ibb.co/d6Lysw0/image.png) and gives this error (https://i.ibb.co/HqWkQ53/image.png)

The code above contains osc_user_id because I thought that might fix it. Originally it has osc_item_user_id, but that did not work either and gave the same error.

When I looked in the functions of the user rating plugin though I noticed that osc_item_user_id seems to be on everything but I figure that it doesn't exist on a public profile page.
Title: Re: Latest version failing to get user on public profile
Post by: MB Themes on August 05, 2021, 07:54:17 AM
@Marceus
You should provide user ID.
In previous versions user ID was identified automatically by plugin, but it was not correct. It might return user ID not related to one you were showing.
In user public profile, user id should be osc_user_id() or Params::getParam('id') - depends on theme and osclass version. Best is to find user ID at start of file and then keep it in variable.
Title: Re: Latest version failing to get user on public profile
Post by: Macreus on August 05, 2021, 06:27:51 PM
@Marceus
You should provide user ID.
In previous versions user ID was identified automatically by plugin, but it was not correct. It might return user ID not related to one you were showing.
In user public profile, user id should be osc_user_id() or Params::getParam('id') - depends on theme and osclass version. Best is to find user ID at start of file and then keep it in variable.

I have tried osc_user_id() as I said and that does not work, I tried Params::getParam('id') as you suggested but that still returns the same error.  At the top of user-public-profile, $user is defined as "  $user = osc_user(); ", I have tried replacing osc_user_id() with osc_user(), but that does not work either.

Also, really love the new facelift, looks great, just hoping to get it working on the public profile page!
Title: Re: Latest version failing to get user on public profile
Post by: MB Themes on August 05, 2021, 10:14:25 PM
You can get it as $user['pk_i_id']
Title: Re: Latest version failing to get user on public profile
Post by: Macreus on August 06, 2021, 02:24:08 AM
You can get it as $user['pk_i_id']

Thanks for the suggestion, I tried that but it gives me the same error

Code: [Select]
         <?php if(function_exists('ur_show_rating_stars') && $user['pk_i_id'] > 0) { ?>
            <span class="ur-fdb">
<span class="strs"><?php echo ur_button_stars(); ?></span>
<br>
              <span class="lnk"><?php echo ur_button_add(); ?></span>
            </span>
          <?php ?>

(https://i.ibb.co/n8JSFxD/image.png)


I think the issue lies within functions in the plugin file, it's always looking for the itemID and when it comes back null, userid gets returned null as well because of the &&.

If I hover over, I can see the preview of the link it wants to make : (https://i.ibb.co/QcRQy8F/image.png)

Thanks

Title: Re: Latest version failing to get user on public profile
Post by: MB Themes on August 06, 2021, 08:44:12 AM
@Macreus
You must provide that ID into function.
Code: [Select]
         <?php if(function_exists('ur_show_rating_stars')) { ?>
            <span class="ur-fdb">
<span class="strs"><?php echo ur_button_stars($user['pk_i_id']); ?></span>
<br/>
                <span class="lnk"><?php echo ur_button_add($user['pk_i_id']); ?></span>
            </span>
          <?php ?>
Title: Re: Latest version failing to get user on public profile
Post by: Macreus on August 06, 2021, 01:18:59 PM
@Macreus
You must provide that ID into function.
Code: [Select]
         <?php if(function_exists('ur_show_rating_stars')) { ?>
            <span class="ur-fdb">
<span class="strs"><?php echo ur_button_stars($user['pk_i_id']); ?></span>
<br/>
                <span class="lnk"><?php echo ur_button_add($user['pk_i_id']); ?></span>
            </span>
          <?php ?>

That works great, thank you for your help!
Title: Re: Latest version failing to get user on public profile
Post by: Macreus on August 06, 2021, 02:24:30 PM
Ah I do have one more slight issue, on monochrome, it seems to work fine but with that ticked off, I get this
(https://i.ibb.co/D9DbyCF/image.png)

If the user has a mediocre rating they still get a full set of stars in a different colour, it should be 3 yellow stars?
Title: Re: Latest version failing to get user on public profile
Post by: MB Themes on August 06, 2021, 02:38:03 PM
@Macreus
Can you send URL to such profile/rating?
Title: Re: Latest version failing to get user on public profile
Post by: Macreus on August 06, 2021, 03:29:35 PM
@Macreus
Can you send URL to such profile/rating?

Yes of course, I will PM you.
Title: Re: Latest version failing to get user on public profile
Post by: MB Themes on August 06, 2021, 03:50:16 PM
Update plugin user.css with this one:
https://plugins3.abprofitrade.eu/oc-content/themes/sigma/css/style.css?v=20210806154925

There was 1 word missing, should be ok then ;)
Title: Re: Latest version failing to get user on public profile
Post by: Macreus on August 06, 2021, 04:45:06 PM
Update plugin user.css with this one:
https://plugins3.abprofitrade.eu/oc-content/themes/sigma/css/style.css?v=20210806154925

There was 1 word missing, should be ok then ;)

Thanks, I'm not sure which CSS to replace here, I can't find any that look remotely similar. I don't have a style.css in the plugin folder css folder, only user.css, tipped.css, bootstrap-switch.css and admin.css

I did try swapping out the user.css but that was wrong.

The theme style.css, i.e gamma/css/style.css is also completely different so I don't think that's the right one either
Title: Re: Latest version failing to get user on public profile
Post by: Macreus on August 06, 2021, 04:49:26 PM
I think maybe you sent wrong url. I changed the URL you sent me to https://plugins3.abprofitrade.eu/oc-content/plugins/user_rating/css/user.css (https://plugins3.abprofitrade.eu/oc-content/plugins/user_rating/css/user.css)

Knowing what you said about one word being wrong I looked to the relevant location and noticed

Code: [Select]
.ur-rate.ur-gray > span, .ur-rate.ur-has-cl.ur-gray > span, .ur-rate.ur-not-hover > span, .ur-rate.ur-select.ur-not-hover > span, .ur-rate.ur-not-select > span {background-color:#aaa;}
Which is different to my user.css which was

Code: [Select]
.ur-rate.ur-gray > span, .ur-rate.ur-not-hover > span, .ur-rate.ur-select.ur-not-hover > span, .ur-rate.ur-not-select > span {background-color:#aaa;}

All working great now! Many thanks, love the new design.
Title: Re: Latest version failing to get user on public profile
Post by: MB Themes on August 06, 2021, 05:33:50 PM
Great  ;)