1 of 2
1
Error with pulling Avatar
Posted: 18 July 2008 03:26 PM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  39
Joined  2007-09-24

Hello,

The ratings module works great.  However, for some reason it very rarely gives me this error:

MySQL ERROR:

Error Number: 1064

Description
: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '}' at line 1

Query
: SELECT avatar_filename, avatar_width, avatar_height FROM exp_members WHERE member_id ={member_id}

The code above is my way of grabbing the avatar of the member that is posting the rating.

I did some troubleshooting and found the “rating entry” that was triggering this error.  I noticed that this particular rating didn’t have a screenname associated with it.  I am not sure why this happens sometimes, but it seems like every once in a while the rating module doesnt grab the users screenname.  Then an error happens when the query above runs.

Deleting the erroneous comment fixes the error, however I would like to prevent this permanently.  Any ideas?

Thanks!

Profile
 
 
Posted: 18 July 2008 03:52 PM   [ Ignore ]   [ # 1 ]
Jr. Member
RankRank
Total Posts:  39
Joined  2007-09-24

Also, when I go to the erroneous comment I get the following message on the top of the screen

Notice: Undefined index: screen_name in /home/djbooth/public_html/control/modules/rating/mcp.rating.php on line 1225

Also note that the error just seems to appear - in other words, the screen name is there, and then at some point it disappears.

Profile
 
 
Posted: 21 July 2008 07:51 AM   [ Ignore ]   [ # 2 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

dmacli,

What does your full template code look like? smile

 Signature 
Profile
 
 
Posted: 21 July 2008 08:37 AM   [ Ignore ]   [ # 3 ]
Jr. Member
RankRank
Total Posts:  39
Joined  2007-09-24

Here it is:

<div id="title585"><H3 class="title">Member Reviews and Ratings</H3></div>

    
{exp:weblog:entries weblog="{segment_1}" require_entry="yes"}
    
<br>
    <
center><a class="small" href="#comment">Leave your Comment on {title}</a></center>
    <
br>
    
{/exp:weblog:entries}


    
<!--Show Ratings-->

    
{exp:rating:entries sort="asc" theme="default"}
    {if review}
    
<center>
    <
table class="{switch="comment|comment2"}">
    <
tr>
  <
td width="115" valign="top" rowspan="2">
  <
center><a class="header" href="http://www.djbooth.net/index/dj/profile/{member_id}">{screen_name}<br><br>
    
{exp:query sql="SELECT avatar_filename, avatar_width, avatar_height FROM exp_members WHERE member_id ={member_id}"}
{if avatar_filename
!=""}
<a href="{path=dj/profile/{member_id}}" border="0"><img src="http://www.djbooth.net/images/avatars/{avatar_filename}" width="{avatar_width}" height="{avatar_height}" alt="{screen_name}" style="border:1px solid #000;"></a>
{/if}
{
/exp:query}
    
</a>
    </
center>
  </
td>
  <
td width="420" valign="top">
    
{if rating}<font class="small">Rating: &nbsp;</font>{stars}{rating}{/stars}
    
&nbsp; &nbsp; &nbsp; &nbsp;<a class="small" href="{path=dj/profile/{member_id}}">{screen_name}'s Top Rated Songs</a>
    <br><br>{/if}
    {exp:html_strip}{review}{/exp:html_strip}
    <br><br>
  </td>
  </tr>
  <tr>
  <td align="right"><font size="1">Posted on {rating_date format="%M %d, %Y"}</font>
  </td>
    </tr>
   </Table>
   </center>
   <br>
   {/if}

    {/exp:rating:entries}

  <br>

    <div id="title585"><H3 class="title">Submit Your Review</H3></div>
    <br>
    {if logged_in}
  <center>
  {screen_name}, Please let us know what you think of<br>
  {exp:weblog:entries weblog="{segment_1}" require_entry="yes"}{title}{/exp:weblog:entries}

{exp:rating:form entry_id="{entry_id}" form_name="{segment_1}" require_membership="no" status="open" return="{path={segment_1}/{segment_2}/{segment_3}}"}

<textarea name="review" rows="8" cols="60"></textarea>
<br>
<label for="review"><b>Rating:</b></label>
<select name="rating">
<option value="">Select</option>
<option value="1">1 - Garbage</option>
<option value="2">2 - OK</option>
<option value="3">3 - In Rotation</option>
<option value="4">4 - Banger</option>
<option value="5">5 - Classic</option>
</select>
&nbsp; &nbsp;
<input type="submit" name="submit" value="Submit!" />&nbsp;
<br>
<font size="1">Please Rate Only Once</font>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
{/exp:rating:form}
</center>
<br><br>
    {/if}

    {if logged_out}
   <center>
  You must be logged in to post comments.  Please log in below or <a class="header" href="{path=member/register}">Register</a>.<br>
  {exp:member:login_form return="{path={segment_1}/{segment_2}/{segment_3}}"}
  <label>Username</label> &nbsp; <input type="text" name="username" value="" maxlength="32" class="input" size="10" />
  &nbsp; &nbsp; &nbsp;
  <label>Password</label> &nbsp; <input type="password" name="password" value="" maxlength="32" class="input" size="10" />
  &nbsp; &nbsp; &nbsp;
  <br><br>
  {if auto_login}<input class='
checkbox' type='checkbox' name='auto_login' value='1' /> Remember Me{/if}
  &nbsp; &nbsp; &nbsp;
  <input type="submit" name="submit" value="Submit" />
  <br>
  <p><a class="small" href="{path=member/forgot_password}">Forgot your password?</a></p>
  <div style="border: 1px solid #336699;"><br><a class="header" href="{path=member/register}">Not a Member?  Become a Member of DJBooth.net!</a><br><br></div>
  {/exp:member:login_form}
  <br><br>
  </center>
    {/if}

Thanks!

Profile
 
 
Posted: 22 July 2008 05:55 AM   [ Ignore ]   [ # 4 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

Is there any chance that you have another form, or at one time, had a form that allowed Guest ratings? smile

Additionally, you should remove this parameter if you want only members Rating Entries (I know, you have the {if logged_in} conditional, just saying though:

require_membership="no"

I would also change {screen_name} to {logged_in_screen_name}, especially if you’re placing a Rating Form within a Weblog:Entries loop, as the variables will sometimes collide. wink

 Signature 
Profile
 
 
Posted: 22 July 2008 06:14 AM   [ Ignore ]   [ # 5 ]
Jr. Member
RankRank
Total Posts:  39
Joined  2007-09-24

Thanks a million!  I will try this out tonight.  Good catch with the require membership parameter.

Another related question, you will notice that I have used a query to pull the avatar of each person who rated the track.  Is there an easier way to do this - i.e. a standard variable.

Profile
 
 
Posted: 22 July 2008 09:33 AM   [ Ignore ]   [ # 6 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

I’m assuming you’ve tried {if avatar}{avatar}{/if}? smile

 Signature 
Profile
 
 
Posted: 28 July 2008 05:46 PM   [ Ignore ]   [ # 7 ]
Jr. Member
RankRank
Total Posts:  39
Joined  2007-09-24

No, for some reason that doesnt work.  Should it?

Profile
 
 
Posted: 28 July 2008 05:46 PM   [ Ignore ]   [ # 8 ]
Jr. Member
RankRank
Total Posts:  39
Joined  2007-09-24

It works in comments, but not in ratings (i use both, depending on the weblog)

Profile
 
 
Posted: 28 July 2008 05:54 PM   [ Ignore ]   [ # 9 ]
Jr. Member
RankRank
Total Posts:  39
Joined  2007-09-24

Hey pie man, just a note, I changed “require_membership” to yes and the text box no longer showed up!

Profile
 
 
Posted: 29 July 2008 06:47 AM   [ Ignore ]   [ # 10 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18
dmacli - 28 July 2008 05:54 PM

Hey pie man, just a note, I changed “require_membership” to yes and the text box no longer showed up!

Which text box no longer shows up?
Also, just remove the parameter altogether smile

 Signature 
Profile
 
 
Posted: 26 August 2008 07:41 PM   [ Ignore ]   [ # 11 ]
Jr. Member
RankRank
Total Posts:  39
Joined  2007-09-24

I took the require membership parameter out of the exp:ratings:

{exp:rating:form entry_id="{entry_id}" form_name="{segment_1}" status="open" return="{path={segment_1}/{segment_2}/{segment_3}}"}

<textarea name="review" rows="8" cols="60"></textarea>
<
br>
<
label for="review"><b>Rating:</b></label>
<
select name="rating">
<
option value="">Select</option>
<
option value="1">1 - Garbage</option>
<
option value="2">2 - OK</option>
<
option value="3">3 - In Rotation</option>
<
option value="4">4 - Banger</option>
<
option value="5">5 - Classic</option>
</
select>
&
nbsp; &nbsp;
<
input type="submit" name="submit" value="Submit!" />&nbsp;
<
br>
<
font size="1">Please Rate Only Once</font>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
{/exp:rating:form}
</center>
<
br><br>
{/if}

And the form no longer shows up.

Profile
 
 
Posted: 28 August 2008 07:51 AM   [ Ignore ]   [ # 12 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

dmacli,

We’ll be launching Rating 2.2 today, which covers a tremendous amount of bugs, including some new features.

Is it alright if we wait until then to see if it solves any of these issues? smile

I will notify you once it becomes available smile

 Signature 
Profile
 
 
Posted: 28 August 2008 08:40 PM   [ Ignore ]   [ # 13 ]
Jr. Member
RankRank
Total Posts:  39
Joined  2007-09-24

Of course you can.  I LOVE updates!  Cant wait!

Profile
 
 
Posted: 29 August 2008 07:13 AM   [ Ignore ]   [ # 14 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

dmacli,

I have even better news LOL
We’ve delated the launch of Rating (yet one more time) rasberry to today.

Just as of yesterday, we’ve added a few more features, including full support for Member function such as Avatars, Photos, and Signatures.

It may not particular solve any “previous” issues, but if any of them are related to your current workaround, this should be the end to any new occurances smile

 Signature 
Profile
 
 
Posted: 29 August 2008 07:20 AM   [ Ignore ]   [ # 15 ]
Jr. Member
RankRank
Total Posts:  39
Joined  2007-09-24

Awesome, does it also allow you to pull up ratings only for a particular member group?  That would be sweet!

Direct me to the change log when it comes out.

Profile
 
 
   
1 of 2
1