Recent Topics

1 Sep 05, 2008 10:13    

Hi,

I want to be able to add a custom message (like an invitation to register to my site) when a reader tries to access a protected post; instead of the 'Sorry, there is nothing to display' message. Where would I change the message?

I'm also getting this error:

Trying to get property of non-object in /public_html/inc/_core/model/dataobjects/_dataobjectcache.class.php on line 283

when logged out and going to the url of a protected post.

Thanks,

Na

2 Sep 05, 2008 11:17

inc/items/model/_itemlistlight.class.php ( approx 913 ), change it to look like this :

		if( $this->single_post )
		{	// We have requested a specific post:
			// Should be in first position
			if( !$this->result_num_rows )
			{ // we have no items
				$Item = NULL;
			}
			else
			{ // grab first items title
				$Item = & $this->get_by_idx( 0 );
			}

¥

3 Sep 05, 2008 19:05

Thanks Yabba - that takes care of the error.

I'm still left with the custom message issue though...

4 Sep 07, 2008 01:43

Just a side note:

in changing the error above with your code Yabba, it gets rid of the single post's title in the browser. Ie. If I have a post called 'How to do this' on the page 'Learn' (and the title is 'Learn - How to do this'), it now shows only 'Learn' in the title. Is there anyway to fix it so it shows the post title again?

Thanks!

Na

6 Sep 07, 2008 11:29

Thanks. I'm still not showing the title in the browser, but at least I'm not getting an error! :)

7 Sep 08, 2008 17:39

Hmmm, weird ... I'll have to tell Tblue that his code is flawed and let him work out why .... life's hard :D

btw :
Custom error when logged out and no post ( note : this doesn't detect if there *would* have been a post if logged in ;) ) :

display_if_empty( 'msg_empty' => ( is_logged_in() ? T_(' There is no post to display' ) : 'your custom message' ) );

ish :roll:

¥

8 Sep 08, 2008 18:25

Thanks - actually that new code sort of doesn't help me. I'm tricking the site into doing something special: when someone comes across a protected post, I want them to see an invitation message to become a member. So if they're logged in, with your new code, they'd still see the invite - which doesn't make much sense to the person logged in.

Perhaps this isn't the best way to do it, but I couldn't figure out another way.

Thanks for the help though Yabba - always nice to have someone giving good advice!

9 Sep 08, 2008 19:20

If they're logged in then they'll see the "T_('there is no post fool!')" ?

Nice off you to stroke my ego though ... I'm blonde and we purrrrrrrrrrr better than a cute cat ..... not that I like cats, but you get the picture?

¥

10 Sep 10, 2008 03:42

Thanks

By the way, I put back the code for itemslistlight (but left all other changes as suggested by you) and now there's no error plus the browser titles are back.


Form is loading...