Keyword

Show registered item summary to public

  • Prashanth
  • Prashanth's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 month ago #86410 by Prashanth
Show registered item summary to public was created by Prashanth
Hi,
I would like to be able to show items marked for registered users only in the category listing even for public users. That was the public users get to see a summary of the article and on clicking read more they are asked to register. Kindly let me know which file i need to edit to be able to do this.

Thanks
Prashanth

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #86411 by Jiliko.net
Replied by Jiliko.net on topic Show registered item summary to public
Hi Prashanth,

You can do that :

- Override K2 template to avoid k2 core files modification and K2 update problem : doc here
- Modify item.php and category.php of your K2 template to test if a registered user is connected and display what you want (full text or summary+registration link).

Olivier

Please Log in or Create an account to join the conversation.

  • Prashanth
  • Prashanth's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 month ago #86412 by Prashanth
Replied by Prashanth on topic Show registered item summary to public
Hi Olivier,

What i wanna do is display items marked for registered users only in the category listing. In category.php, i donot see any code where there is a check for the access right of the item. No matter what the access rights of the item be, i wanna show it in the category listing. Can you tell me as to where are the access rights for a particular item checked?

Thanks
Prashanth

Olivier Nolbert said:Hi Prashanth,
You can do that :

- Override K2 template to avoid k2 core files modification and K2 update problem : doc here
- Modify item.php and category.php of your K2 template to test if a registered user is connected and display what you want (full text or summary+registration link).

Olivier

Please Log in or Create an account to join the conversation.

  • Prashanth
  • Prashanth's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 month ago #86413 by Prashanth
Replied by Prashanth on topic Show registered item summary to public
I just modified the getData() function under models/itemlist.php to not check for access id and that did the trick for me as i would like any user to see the item list but access to the full article must be restricted.

Prashanth said:Hi Olivier,

What i wanna do is display items marked for registered users only in the category listing. In category.php, i donot see any code where there is a check for the access right of the item. No matter what the access rights of the item be, i wanna show it in the category listing. Can you tell me as to where are the access rights for a particular item checked?

Thanks
Prashanth

Olivier Nolbert said:Hi Prashanth, You can do that :

- Override K2 template to avoid k2 core files modification and K2 update problem : doc here
- Modify item.php and category.php of your K2 template to test if a registered user is connected and display what you want (full text or summary+registration link).

Olivier

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #86414 by Jiliko.net
Replied by Jiliko.net on topic Show registered item summary to public
Prashanth,

Sure, your solution works but now, you have to care about K2 updates which could/will override your modifications.

In category.php, which processes display of the category listing, you have to add the access right code. By doing this in your own K2 template, you don't have to care about future K2 updates.

Olivier

Please Log in or Create an account to join the conversation.

  • Prashanth
  • Prashanth's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 month ago #86415 by Prashanth
Replied by Prashanth on topic Show registered item summary to public
Hi Olivier,

I dont understand how i can modify category.php.
The list of items category.php would receive will not have the items marked for registered users and the getData function would perform an SQL query for only items marked for public users. So in category.php, i will not be able to do anything as i donot have the items in the first place.

Am i missing something here.

Thanks
Prashanth

Olivier Nolbert said:Prashanth,
Sure, your solution works but now, you have to care about K2 updates which could/will override your modifications.

In category.php, which processes display of the category listing, you have to add the access right code. By doing this in your own K2 template, you don't have to care about future K2 updates.

Olivier

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #86416 by Jiliko.net
Replied by Jiliko.net on topic Show registered item summary to public
Hi Prashanth,

What do you mean by 'marked item', how do you do that ?

In the category.php, you can add code to test if a user is connected, and if so, displaying the item full text.

Maybe i am missing something too.

Olivier

Please Log in or Create an account to join the conversation.

  • Prashanth
  • Prashanth's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 month ago #86417 by Prashanth
Replied by Prashanth on topic Show registered item summary to public
I want the guest users to be able to see all the items in the category listing (including items whose access rights are set to registered). But when the guest user clicks on read more, he should not be able to see the complete article but should be asked to go register / login

In K2 if an item has access rights of registered, the category listing would not show the item to guest users. This is because under model/itemlist.php the SQL query gets only the items whose access id is <= the users access id.

This is why i had to modify the SQL query itself as I would be unable to do anything in category.php.

Can you think of any other way that i could have done this?

Olivier Nolbert said:Hi Prashanth,
What do you mean by 'marked item', how do you do that ?

In the category.php, you can add code to test if a user is connected, and if so, displaying the item full text.

Maybe i am missing something too.

Olivier

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #86418 by Jiliko.net
Replied by Jiliko.net on topic Show registered item summary to public
Prashanth,

Sure, i've missed a thing, a BIG thing :-)

Your solution is the only one, unfortunately...

Olivier

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #86419 by ehsan rezazadeh
Replied by ehsan rezazadeh on topic Show registered item summary to public
hi

im not very professional in programming .i have the same problem too.

can u help me to solve it step by step?

how can i show the registered item title to global users?

 

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum