Topic Count in Profiles

Started by live627, August 18, 2009, 10:40:38 AM

Previous topic - Next topic

Rohan_

Arantor i wanna tell you something bro :) really :) i wanna be a expert in PHP and want to make mods and give them to you :) i wanna give you something i dont want anything from you :) you already given me a lot .. Thanks for all
Proud To Be An Indian

kai920

I'm getting this database error, I believe only when a bot visits my forum:

Guest
66.249.68.46   
Type of error: Database

http://mysite.com/forums/index.php?action=profile;area=statistics;u=37

Database Error: Unknown column 'b.member_groups' in 'where clause'

File: /home/public_html/forums/Sources/Profile-View.php
Line: 828

If I open up that file, just before line 828 there is this query which I believe is from this mod:



   // Grab the topic this member posted in most often.
   $result = $smcFunc['db_query']('', '
      SELECT
         b.id_topic, MAX(m.subject) AS name, MAX(b.num_replies) AS num_replies, COUNT(*) AS message_count
      FROM {db_prefix}messages AS m
         INNER JOIN {db_prefix}topics AS b ON (b.id_topic = m.id_topic)
      WHERE m.id_member = {int:current_member}
         AND {query_see_board}
      GROUP BY b.id_topic
      ORDER BY message_count DESC
      LIMIT 10',
      array(
         'current_member' => $memID,
      )
   );




Arantor

Interesting query.

* Arantor would STRONGLY suggest not using COUNT(*) in a query. Bad for performance, when COUNT(id_msg) would yield better performance on InnoDB and PostgreSQL.
Holder of controversial views, all of which my own.

live627

Quote from: Arantor on December 07, 2009, 02:37:15 AM
* Arantor would STRONGLY suggest not using COUNT(*) in a query. Bad for performance, when COUNT(id_msg) would yield better performance on InnoDB and PostgreSQL.

Thanks for the tip.

@kai920: Can guests view profiles? Do you use the 1.1 branch or the 2.0 branch?

kai920

Quote from: live627 on December 07, 2009, 04:48:16 PM
@kai920: Can guests view profiles? Do you use the 1.1 branch or the 2.0 branch?


I am using 2.0 RC2, and guests can view the main user profile page.

I just tried viewing a profile as a guest, and there was no db error logged. Could this error affect bots only?

Cal O'Shaw

Hello,

We use 1.1.11 and we were wondering if there is a way to disable the option to list all the topics a member has participated in.  We have some members who have been busy everywhere.

Also, is it possible to add a screenshot of what the 1.1.x member sees with the additional stats (new page or part of the =statPanel ?)

Grazie

live627

Updated to 1.5.2: Added options to disable number of topics started and number of topics participated in for all three versions (1.1, 2.0 RC1, 2.0 RC2)

Cal O'Shaw

Wow, that was fast!

Does that disable the ability to list the topics?  We don't have a problem with showing a number, but with having the site process the queries asking for a list of every topic (especially if the list query doesn't know to not include topics normally invisible to members, such as Admin-only topics).

Grazie,

Cal

Cal O'Shaw

Hi,

Just installed 1.52 and found a bug and had a question.

The bug: I clicked the "show Posts" link and the first page displayed is the initial posts of topics, and the count of pages (the "1, 2, 3... 13") is likely correct, the header says "Show Posts" and if I click on "2", it switches to showing posts (the count of pages increases and the end of the URL changes from "ShowTopics" to "ShowPosts").

The question: where in the AdminCP are the settings for controlling access to the Topic counts?

Grazie

Cal

kai920

I'm still getting the database errors. Any ideas what I can try in order to find the cause of the problem?

live627

I had another play to try to figure out the interesting query and finished with 1.5.3

Options for this mod:

  • 1.1.x - Features and Options -> Topic Count in Profile
  • 2.0.x - Configuration -> Modifications -> Topic Count in Profile

Cal O'Shaw

#51
Good news with 1.5.3:
- Admin settings control showing topic counts
- 'Show Topics' correctly displays topics after the first page

Things to look at in 1.5.3:
- 'Show Topics' is displayed no matter what boxes are checked.  This is, topics started may not appear, but the 'Show topics' is still visible.
- Although 'Show Topics' works correctly, the title is still 'Show Posts'.
- Would you consider adding a checkbox to control if the "Show Topics" link is displayed?

This is a really nice MOD!

You've been very responsive and quick with updates.

Grazie mille!

Cal

kai920

Quote from: live627 on December 11, 2009, 08:20:28 PM
I had another play to try to figure out the interesting query and finished with 1.5.3

Options for this mod:

1.1.x - Features and Options -> Topic Count in Profile2.0.x - Configuration -> Modifications -> Topic Count in Profile[/list]


Thanks very much live627. Will test and report back results!  :)

live627

Quote from: Cal O'Shaw on December 11, 2009, 09:01:46 PM
- 'Show Topics' is displayed no matter what boxes are checked.  This is, topics started may not appear, but the 'Show topics' is still visible.
- Although 'Show Topics' works correctly, the title is still 'Show Posts'.
- Would you consider adding a checkbox to control if the "Show Topics" link is displayed?

This is a really nice MOD!

You've been very responsive and quick with updates.

Grazie mille!

Cal


  • Added an option to show/hide the list of topics
  • title fixed

Thanks for liking this mod

Cal O'Shaw

Hello,

Just installed the revised 1.5.3.  Saw the additional checkbox.

Many thanks!

(the show topics still has "Latest posts of: (memberid)" in the browser tab and the table of the posts is still saying "Show Posts" but the function is there and that's what counts :) ).

Grazie!

Cal

kai920

Quote from: kai920 on December 07, 2009, 02:32:22 AM
I'm getting this database error, I believe only when a bot visits my forum:

Guest
66.249.68.46   
Type of error: Database

http://mysite.com/forums/index.php?action=profile;area=statistics;u=37

Database Error: Unknown column 'b.member_groups' in 'where clause'

File: /home/public_html/forums/Sources/Profile-View.php


Quoting previous error for reference, but have a slightly different error now: (1.5.3)

Database Error: Unknown column 'b.id_topic' in 'on clause'
File: /home/public_html/forums/Sources/Profile-View.php
Line: 833

beltazar

#56
Quote from: kai920 on December 12, 2009, 04:21:51 AM
Quote from: kai920 on December 07, 2009, 02:32:22 AM
I'm getting this database error, I believe only when a bot visits my forum:

Guest
66.249.68.46   
Type of error: Database

http://mysite.com/forums/index.php?action=profile;area=statistics;u=37

Database Error: Unknown column 'b.member_groups' in 'where clause'

File: /home/public_html/forums/Sources/Profile-View.php


Quoting previous error for reference, but have a slightly different error now: (1.5.3)

Database Error: Unknown column 'b.id_topic' in 'on clause'
File: /home/public_html/forums/Sources/Profile-View.php
Line: 833

I'm using SMF2RC2 & have this error too

change b.id_topic to b.id_board


kai920

Quote from: beltazar on December 12, 2009, 12:19:58 PM
I'm using SMF2RC2 & have this error too

change b.id_topic to b.id_board


You mean like this?


Code (search) Select

         INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
         INNER JOIN {db_prefix}boards AS b ON (b.id_topic = m.id_topic)



Code (replace) Select

         INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
         INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_topic)


live627


kai920

Quote from: kai920 on December 07, 2009, 02:32:22 AM
I'm getting this database error, I believe only when a bot visits my forum:

Guest
66.249.68.46   
Type of error: Database

http://mysite.com/forums/index.php?action=profile;area=statistics;u=37

Database Error: Unknown column 'b.member_groups' in 'where clause'

File: /home/public_html/forums/Sources/Profile-View.php
Line: 871



Getting this same error, except now it's line 871...

Advertisement: