Keyword

Limiting the number of articles

  • Max Cox
  • Max Cox's Avatar Topic Author
  • Offline
  • New Member
More
11 years 6 months ago #111169 by Max Cox
Limiting the number of articles was created by Max Cox
Hi,

I've seen a lot of people asking how to limit number of articles per user, but really have not seen a single solution. I am looking into work around, but not sure how to do it. Basically users on my site can add articles through a link in K2 login module [mod_k2_login] and that is the only way. Can anyone help me to change this bit of code:

<ul class="k2UserBlockActions">
<?php if(is_object($user->profile) && isset($user->profile->addLink)): ?>
<li>
<a class="modal" rel="{handler:'iframe',size:{x:990,y:550}}" href="<?php echo $user->profile->addLink; ?>"><?php echo JText::_('K2_ADD_NEW_ITEM'); ?></a>
</li>
<?php endif; ?>
<li>
<a href="<?php echo JRoute::_(K2HelperRoute::getUserRoute($user->id)); ?>"><?php echo JText::_('K2_MY_PAGE'); ?></a>
</li>


Basically my aim is for 'K2_ADD_NEW_ITEM' to be visible if user has not created any items (item count 0) and become invisible if user has created one (item count 1). At the same time 'K2_MY_PAGE' should be displayed other way around (be invisible if user has created no item and become visible when has created one).

Any advice is highly appreciated!

Thank you

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

  • Max Cox
  • Max Cox's Avatar Topic Author
  • Offline
  • New Member
More
11 years 6 months ago #111170 by Max Cox
Replied by Max Cox on topic Re: Limiting the number of articles
Hired a freelancer and he sorted this out for me for a fee. Now users can only add maximum of 1 article, because soon as they create one, the link 'K2_ADD_NEW_ITEM' dissapears. And they can always edit that item on 'K2_MY_PAGE'.

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


Powered by Kunena Forum