Keyword

List k2 Items owned by logged in user

  • rajeshatbuzz
  • rajeshatbuzz's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 2 months ago #109515 by rajeshatbuzz
List k2 Items owned by logged in user was created by rajeshatbuzz
Hi,

I am trying to create a menu in which i would like to display list of items which has been published/un-published by user.

Can you please let me know how this can be achieved?
The topic has been locked.
More
11 years 2 months ago #109516 by Jiliko.net
Replied by Jiliko.net on topic Re: List k2 Items owned by logged in user
Hi,

You post subjects & content are not saying the same thing. Could you be clear on what you want to achieve ?

The 'User page' K2 menu item displays a K2 user items. When this user is logged in and watches this page, he can see published/unpublished items he has created.

If you want to display on 1 page items for the current logged in user, you'll have to create a new MVC structure on K2 frontend :
- a new controller file that would handle your frontend request
- a new model file that would retrieve items from the logged in user
- a new view file that would manage the data and call the specific layout.
- a new template file with a xml file to manage the menu item params in backend.

Olivier
The topic has been locked.
  • rajeshatbuzz
  • rajeshatbuzz's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 2 months ago #109517 by rajeshatbuzz
Replied by rajeshatbuzz on topic Re: List k2 Items owned by logged in user
Sorry for confusion. Let me clear my requirements again - I would like to have one menu such as "My Articles or My Blog" and depends on logged in user, it will display list of K2 items published by logged in user.

I tried menu type called "User page (blog)" but it further ask for "Select user" means it will create only for specific user, not in general case for all user.


Thanks for your other helpful notes.
The topic has been locked.
More
11 years 2 months ago #109518 by Jiliko.net
Replied by Jiliko.net on topic Re: List k2 Items owned by logged in user
Hi,

To have this, you'll have to add the new MVC structure; K2 can not do this by default.

Olivier
The topic has been locked.
  • Kran Chi
  • Kran Chi's Avatar
  • Visitor
5 years 7 months ago - 5 years 7 months ago #169126 by Kran Chi
Replied by Kran Chi on topic Re: List k2 Items owned by logged in user
It's ridiculous that k2 still doesn't has this feature!

Just need in line 157 of :
components\com_k2\views\latest\view.html.php

below code :
if (is_string($usersIDs) && !empty($usersIDs))
            {
                $usersIDs = array();
                $usersIDs[] = $params->get('userIDs');
            }

changed to
if($OwnedId=JFactory::getUser()->id)
	$usersIDs[]=$OwnedId;
			
if (is_string($usersIDs) && !empty($usersIDs))
            {  
                $usersIDs[] = $params->get('userIDs');
            }

So when in Menu setting, you do not choose any user, K2 shows "owned articles" of logged in users!
Attachments:
Last edit: 5 years 7 months ago by Kran Chi.
The topic has been locked.
More
5 years 7 months ago #169127 by JoomlaWorks
Replied by JoomlaWorks on topic Re: List k2 Items owned by logged in user
This is an unnecessary hack. Why? Because you may actually want to use that view as it is intended.

In your case, simply publish the "K2 User" module somewhere the user can see it when they log in. Better still, use it as the main module for user to log in. They can always then access their content (their user page) by clicking on "My Page" as seen here: jmp.sh/7uFki9m

If you want to see a live example, signup on getk2.org and look how we did an override and made it a "user toolbar". You can even render any other Joomla menu in there you want, e.g. from Kunena (for user actions).

This has been with K2 for years :)

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
The topic has been locked.
  • Kran Chi
  • Kran Chi's Avatar
  • Visitor
5 years 7 months ago #169169 by Kran Chi
Replied by Kran Chi on topic Re: List k2 Items owned by logged in user
I want to users see [My Items] menu before login and it's can not be done by module. maybe we can show them a custom module or alias menu but these ways are not user friendly and just wasting the time.

So in my opinion, it's better that k2 add this item to menu too . like many other features that didn't care about :

- limit item per user : bit.ly/2D85k12
- better edit Front-end form : bit.ly/2xjPCKQ (even CSS classed are the same!)
- limit tag number in Front-end form (it's unlimited! )
- support 3rd party captcha plugin in comment form (we have to use recaptcha only?)
- ...
The topic has been locked.
More
5 years 7 months ago #169178 by JoomlaWorks
Replied by JoomlaWorks on topic Re: List k2 Items owned by logged in user
The "My Items" menu can just be a link to the login page. Once you login, you see the menu bar and click the option you want. If the user is not logged in there is no point to your version as well (how would the code match the user ID to the K2 user ID if they are not logged in first?)...

As for your other comments:
- limit item per user : bit.ly/2D85k12 - Why?
- better edit Front-end form : bit.ly/2xjPCKQ (even CSS classed are the same!) - the item edit form has changed substantially since v2.7.0.
- limit tag number in Front-end form (it's unlimited! ) - use locked tags, this feature exists since v2.0 of K2.
- support 3rd party captcha plugin in comment form (we have to use recaptcha only?) - you can write your own plugin if you want or better still, use another commenting system that supports K2 and has more security options.

We can add all the world's features for sure, but that's not always the best case. K2 has been carefully designed to be extensive for this specific reason.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
The topic has been locked.
  • Kran Chi
  • Kran Chi's Avatar
  • Visitor
5 years 7 months ago - 5 years 7 months ago #169261 by Kran Chi
Replied by Kran Chi on topic Re: List k2 Items owned by logged in user
No it's not! I make a menu and set the permission "Registred". so after login, Joomla will redirect user to "My Items" page. Also I don't want to use a module and define a position for it.

Be sure that this is also other users requirement. Can be clear with a poll! I can't understand why you resist for this tiny improvement :/
Anyway I have to replace the changes after every update.

For other My questions (especially for captcha) I will create a new topic to discuss about that.
Thank you.
Last edit: 5 years 7 months ago by Kran Chi.
The topic has been locked.
More
5 years 7 months ago #169262 by naeime
Replied by naeime on topic Re: List k2 Items owned by logged in user
You must be logged in
The topic has been locked.

Powered by Kunena Forum