Resources

My Agape try

Your Agape try


Support Forum

Current User: Guest Login Register
Please consider registering

Search 
Search Forums:


 




Please make WP tagcloud work with Role Scoper

UserPost

5:13 am
September 7, 2008


Jessica

Member

posts 27

1

(Sorry, I didn't see the notice that usage questions, bug reports or feature requests should'nt be posted in the Role Scoper overview but in the forum at first, so I post my request here too.)

Since WP 2.6 I’m using the tagging system of WordPress itself instead of Simple tagging. By now, the tagcloud just displays the tags used in public posts, those of private posts are ignored even if I’m logged in.

I wonder if it is possible to make wp_tag_cloud / wp_generate_tag_cloud work with your plugin so that the tagcloud displays the tags of all posts the current user is allowed to see due to your plugin.
That would be pretty cool. :-)

(Simple Tagging and Disclose Secrets for some reason just did that, but I do not want to switch back to one of those plugins.)

8:02 pm
September 10, 2008


Kevin

Admin

posts 1326

2

I don't know, but will look into it.  I agree it would be a cool feature.

6:06 pm
January 24, 2009


Jessica

Member

posts 27

3

Are there any news concerning this request?

I would love to see these two features work together, for now my tag cloud is not significant for registered users.

9:47 pm
January 24, 2009


Kevin

Admin

posts 1326

4

Yes, I recently added that feature following another request. Try the latest development snapshot version. The only caveat I'm aware of is that although the tags are filtered for the user's actual post access, the cloud size is still based on total posts.

9:08 am
January 29, 2009


Jessica

Member

posts 27

5

Wow, that's great, thank you. Laughing

(Although I did not try the development version. Wink I'll wait until the feature is part of a regular release. )


3:20 pm
February 6, 2009


Jessica

Member

posts 27

6

Hi Kevin!

I just downloaded and installed the latest version of Role Scoper, RC 0.9, to test the tag cloud feature.

But although I'm logged in, I do not see the tags I used a lot in my restricted posts.
- I suppose that the tag cloud just shows the tags which are used in public posts? I made all of them private because I do not want to have my private stuff on the internet when Role Scoper is deactivated for some reason.

Is it possible to make the tag cloud work nevertheless? Perhaps a new tag cloud function? I do not like the standard cloud that much anyway because it is not customizable at all.

I know this is probably quite some work, but I would still love to see it work. :)

10:54 pm
February 6, 2009


Kevin

Admin

posts 1326

7

Hmmm, tags on private and restricted posts do show for permitted users in my trial.

However, the current state of the art in this new tags filter is such that if any of the following parameters are passed into get_tags, Role Scoper will leave it unfiltered:

exclude, include, offset, parent, child_of, get, name__like, search

If that doesn't explain your results, I'd like to hear more about your configuration - WP version?… tag cloud generated by widget or direct function call by template?… Any hacks to the tag cloud or get_tags functions?

1:56 pm
February 7, 2009


Jessica

Member

posts 27

8

I used wp_tag_cloud to generate the tag cloud. It is in my sidebar without the loop of course:

<?php wp_tag_cloud('smallest=80&largest=350&unit=%&number=70'); ?>

But I also tried the widget.

The results differ, but just slightly. I suppose it is due to the fact, that I changed the standard values of wp_tag_cloud as shown above. Still none of the tags in the private posts show up. (I can see that easily because the many private posts deal with the same topics and have the same tags.)

In the official documentation on the template tags list I do not find anything about a function get_tags. Embarassed

I use WP 2.7 DE-Edition (German edition).

Yes, there is one hack in my theme's function.php:

function repair_tag_cloud_styles( $tagcloud ) {
  return preg_replace('~(\d),(\d)~', '$1.$2', $tagcloud);
}
add_filter('wp_tag_cloud', 'repair_tag_cloud_styles');

It replaces the ',' in the css font-size values with '.'.

2:32 pm
February 9, 2009


Kevin

Admin

posts 1326

9

Did you by chance activate the new Role Scoper option "Assume No Front-end Admin" ?

In the current arrangement, doing so will prevent private post tags from being added to the tag cloud for administrators. I'll correct that.

3:03 pm
February 9, 2009


Kevin

Admin

posts 1326

10

If the "no front-end admin" option doesn't explain your symptom, I am at a loss to reproduce it. Can you help by editing your role-scoper/hardway/hardway_rs.php as follows:

temporarily remove (or comment out) all the following code in flt_get_tags

if ( ! empty($args['exclude']) || ! empty($args['include']) || ! empty($args['offset'])
|| ! empty($args['parent']) || ! empty($args['child_of'])
|| ! empty($args['get']) || ! empty($args['name__like']) || ! empty($args['search']) )
{
  return $results;
}

global $scoper, $current_user;
$taxonomies = array( 'post_tag' );
$key = md5( serialize( $args ) . serialize( $taxonomies ) );
$ckey = md5( $key . serialize($scoper->get_terms_reqd_caps('post')) );
$cache_flag = SCOPER_ROLE_TYPE . '_get_terms';

if ( $cache = $current_user->cache_get( $cache_flag ) )
	if ( isset( $cache[ $ckey ] ) )
	     return apply_filters('get_tags_rs', $cache[ $ckey ], 'post_tag', $args);

and

$cache[ $ckey ] = $results;
$current_user->cache_set( $cache, $cache_flag );

$results = apply_filters('get_tags_rs', $results, 'post_tag', $args);

See if it works then. If not, put in an echo statement to make sure the function is actually running. Then find out what it is setting $qry to, and let me know.

12:58 pm
February 10, 2009


Jessica

Member

posts 27

11

Hi Kevin!

No, "no front-end admin" isn't activated.
I commented out the parts as you said, but still the tag cloud does not change. Cry

Here's the query:

SELECT DISTINCT t.*, tt.count FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id AND tt.taxonomy = 'post_tag' INNER JOIN wp_term_relationships AS tagr ON tagr.term_taxonomy_id = tt.term_taxonomy_id INNER JOIN wp_posts ON wp_posts.ID = tagr.object_id WHERE wp_posts.ID IN (SELECT wp_posts.ID FROM wp_posts LEFT JOIN wp_term_relationships AS tr ON wp_posts.ID = tr.object_id LEFT JOIN wp_user2role2object_rs AS uro ON uro.obj_or_term_id = wp_posts.ID AND uro.src_or_tx_name = 'post' AND uro.scope = 'object' AND uro.assign_for IN ('entity', 'both') AND uro.group_id IN ('6', '7', '8', '1') WHERE 1=1 AND ( ( post_status IN ('private', 'publish') AND ( ( 1=1 ) ) ) ) AND 1=1) LIMIT 45

May be I have activated some wrong options in those private entries? Is there anything I should keep in mind?

4:03 pm
February 10, 2009


Kevin

Admin

posts 1326

12

Please try changing your function flt_get_tags in hardway_rs.php as follows:

change:

$qry = "SELECT DISTINCT t.*, … ";

to:

$qry = "SELECT DISTINCT t.*, COUNT(p.ID) AS count FROM $wpdb->terms AS t"
 . " INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id AND tt.taxonomy = 'post_tag'"
 . " INNER JOIN $wpdb->term_relationships AS tagr ON tagr.term_taxonomy_id = tt.term_taxonomy_id"
 . " INNER JOIN $wpdb->posts AS p ON p.ID = tagr.object_id WHERE p.ID IN ($posts_qry) GROUP BY t.term_id $limit";

That will draw the term count from readable posts instead of the stored count. It should fix your missing private tags AND make all the tag sizing reflect actual read access for the logged user!

6:55 pm
February 11, 2009


Jessica

Member

posts 27

13

Great, it works now! Thank you so much! Laughing

Will I have to change this file with each new version of Role Scoper?

7:31 pm
February 11, 2009


Kevin

Admin

posts 1326

14

No, that code is already in the current Role Scoper version.

You're welcome, and thanks for all your feedback.

1:32 pm
February 13, 2009


Jessica

Member

posts 27

15

I have to thank you for your support and of course the great plugin. Smile It is essential for my blog.

As for the tags: There is still something I really don't understand, but I suppose this is the problem of WP's built-in tag cloud feature and not Role Scoper:

I reorganized my tags the last days - I had far too much - and then I realized that the output of the template tag for the cloud still isn't correct actually. There are tags which are used quite often but they are not displayed while seldom tags do show up.

I used the tag 'convention' 43 times, but it is not displayed. The tag 'ikea' is displayed, although I just used it 2 times! And this is just one example of many. When I increase the number of tags to display, some of the missing tags show up, but the list gets far too long and is still wrong. Although I tested it with 120 tags, 'convention' is still missing.

I really don't get it… Frown

The built-in tagging feature isn't nearly as correct and customizable as many of the great tagging plugins. - But I do not want to change again and tag all of my posts anew. And of course, the chance of making a tagging feature work with other plugins as Role Scoper is bigger when I use the functions WP itself offers instead of other plugins.

4:55 pm
February 13, 2009


Kevin

Admin

posts 1326

16

I'll look into this again later tonight. Seems there's some difference between your configuration / content and mine (though I'm sure private tags are coming through and being sized for me).

5:27 pm
February 13, 2009


Jessica

Member

posts 27

17

As I said it I suppose this isn't a Role Scoper issue.

The private tags are displayed by now, the example tags 'convention' and 'ikea' are public actually. It seems to be a general problem of the built-in tagging feature of WP.

11:16 pm
February 13, 2009


Kevin

Admin

posts 1326

18

Jessica said:

As for the tags: There is still something I really don't understand, but I suppose this is the problem of WP's built-in tag cloud feature and not Role Scoper: There are tags which are used quite often but they are not displayed while seldom tags do show up.


No, that was my fault. In the low-level tag query, I forgot to order the results by post count so that the results are your top N tags. This is fixed in rc9.9215, which also adds full support for all applicable get_tags / get_terms arguments.

2:23 am
February 14, 2009


Jessica

Member

posts 27

19

Everything is all right now with rc9.9215! Laughing

10:51 am
October 26, 2009


victar

Member

posts 33

20

I've been having some trouble with this today. I'm using the most recent dev. Any new tips?



Reply to Topic: Please make WP tagcloud work with Role Scoper

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 9 + 11        (Required)

Topic Reply:


 

About the Agapetry forum

Currently Online:

9 Guests

Maximum Online: 88

Forums:

Groups: 2

Forums: 7

Topics: 667

Posts: 3053

Members:

There are 601 members

There are 1 guests


Kevin has made 1326 posts

Top Posters:

metal450 - 98

YikYak - 58

Ragnar - 36

Daisy - 35

LorenW - 33

Administrator: Kevin | Moderators: Kevin