| User | Post |
|
3:13 pm August 10, 2011
| whiteorb
Member
| | whiteorb | |
|
| posts 49 |
|
|
yeah it displays fine. I've been using this with a custom field for a while.
<?php
$software_type = get_post_meta($post->ID, "software-type", true);
if ($software_type === "server") {
echo '<img src="/wp-content/themes/openeye/images/partner-star-medium.png" style="float:right;" />';
};
?>
This works as well
<?php
echo '<img src="/wp-content/themes/openeye/images/partner-star-medium.png" style="float:right;" />';
?>
And for good measure so does this
<?php
echo 'Woot! It works';
?>
|
|
|
4:21 pm August 10, 2011
| Kevin
Admin
| | | |
|
| posts 2503 |
|
|
Okay, but you still haven't answered these questions:
Does the post have a Category Restriction or Post Restriction? What type of role assignment lets them see it?
|
|
|
4:32 pm August 10, 2011
| whiteorb
Member
| | whiteorb | |
|
| posts 49 |
|
|
Sorry,
Yes it is restricted to the following roles. It works, and they only appear when the user is logged in.
- integrator
- distributor
- marketing
- sales
|
|
|
4:42 pm August 10, 2011
| Kevin
Admin
| | | |
|
| posts 2503 |
|
|
Are those restrictions set for a category or directly for the post/page?
What role assignments does the user have to overcome the restrictions?
|
|
|
9:03 pm August 10, 2011
| whiteorb
Member
| | whiteorb | |
|
| posts 49 |
|
|
They're set directly on the page/post. They only need to be part of the user role integrator.
If you advise me on which db tables would help I can export them for you.
|
|
|
9:12 pm August 10, 2011
| Kevin
Admin
| | | |
|
| posts 2503 |
|
|
whiteorb said:
If you advise me on which db tables would help I can export them for you.
I'm not sure that's necessary. So you have a Page Role assigned to the [WP rolename] group? Or directly to the userid?
|
|
|
9:15 pm August 10, 2011
| whiteorb
Member
| | whiteorb | |
|
| posts 49 |
|
|
To the role. I've completely avoided assigning permissions to any users.
|
|
|
9:19 pm August 10, 2011
| Kevin
Admin
| | | |
|
| posts 2503 |
|
|
Never mind about the role assignment question. As long as you're only restricting the Reader role, WP Editors will still be able to read it without a page-specific role assignment.
I just ran another test on WP 3.2.1, RS 1.3.45. After restricting the Post Reader role, the Post is still readable to logged Editor and is_restricted_rs() returns true in that post's loop iteration.
Can you pass the post ID into is_restricted_rs() on each iteration? Maybe your loop is somehow clearing the global $post variable which that template function relies on if no arg is passed.
Finally, do you have the same problem if you temporarily switch to the 2010/2011 theme and try your is_restricted_rs() code there? If so, how does your theme's post query / iteration differ?
|
|
|
9:26 pm August 10, 2011
| whiteorb
Member
| | whiteorb | |
|
| posts 49 |
|
|
Unfortunatly working on this remotly is proving difficult. When I get to the office tomorrow I'll try these suggestions. Do you have any other ideas that you would like me to work through when I get in tomorrow.
|
|
|
2:48 pm August 16, 2011
| whiteorb
Member
| | whiteorb | |
|
| posts 49 |
|
|
My query differs many times throughout the site. I can imagine that it's possible I'm causing some level of conflict with the post query. Is there a way to default or reset the query in this case?
This is how a typical query looks.
$software = array(
'post_type' => 'software',
'category_name' => $model,
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
'meta_key' => 'software-status',
'meta_value' => 'current'
);
query_posts( $software );
get_template_part( 'loop', 'software' );
wp_reset_query();
I tested on the 2010 theme and was still unable to get any kind of result. I tested with this inside a page that is restricted and within a page that is restricted.
if (is_restricted_rs()) {
echo '<h1>huge text test</h1>';
};
I also tried with (is_restricted_rs($post->ID))
|
|
|
7:39 am August 17, 2011
| Kevin
Admin
| | | |
|
| posts 2503 |
|
|
whiteorb said:
I also tried with (is_restricted_rs($post->ID))
Can you confirm that the $post->ID value is valid at that point?
|
|
|
3:45 pm August 18, 2011
| whiteorb
Member
| | whiteorb | |
|
| posts 49 |
|
|
Yeah the post ID echos properly.
|
|
|
4:45 pm February 27, 2012
| whiteorb
Member
| | whiteorb | |
|
| posts 49 |
|
|
So I'm still unable to get this working. Perhaps I should explain what I'm trying to accomplish.
I'm doing a post query and the goal is to simply list the pages that are restricted.
$query = array(
'post_type' => 'page',
'posts_per_page' => -1,
'order' => 'DES',
);
query_posts( $query );
if (have_posts()) : while (have_posts()) : the_post();
After the_post(); if I add if (is_restricted()) { it'll simply show the current page I'm on.
So what I need to be able to do is query pages that are restricted. Any idea how I can accomplish this?
|
|
|
12:12 pm February 29, 2012
| Kevin
Admin
| | | |
|
| posts 2503 |
|
|
Did you try this?
if ( is_restricted_rs( $GLOBALS['post']->ID ) ) {
|
|
|
12:29 pm February 29, 2012
| whiteorb
Member
| | whiteorb | |
|
| posts 49 |
|
|
Just tried it, it returned the "current" page.
http://i.imgur.com/ZIkXx.jpg
Here's my code exactly.
<?php
$qa = array(
'post_type' => 'page',
'posts_per_page' => -1,
'order' => 'DES',
);
query_posts( $qa );
if (have_posts()) : while (have_posts()) : the_post();
if ( is_restricted_rs( $GLOBALS['post']->ID ) ) { ?>
<tr class="docid-loop-tr">
<td><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'openeye' ), the_title_attribute( 'echo=0' ) ); ?>">
<?php the_title(); ?>
</a>
</td>
<td><?php the_ID(); ?></td>
<td><?php the_time('m/d/Y') ?></td>
<td><?php the_modified_author(); ?></td>
<td><?php meta('old-faq-id'); ?></td>
<td><?php echo getPostViews(get_the_ID());?></td>
<td><?php edit_post_link( __( 'Edit', 'openeye' ), '<span class="edit-link">', '</span>' ); ?></td>
</tr>
<?php } endwhile; endif; ?>
|
|
|
12:55 pm February 29, 2012
| Kevin
Admin
| | | |
|
| posts 2503 |
|
|
Insert this before the query_posts call:
$GLOBALS['scoper']->listed_ids = array();
|
|
|
12:58 pm February 29, 2012
| whiteorb
Member
| | whiteorb | |
|
| posts 49 |
|
|
Excellent! that worked very well.
|
|