Mel VIP
Total posts: 126
15 Март 2014 01:24

I need to restrict the view of the 'email' contact field in members records for users who have not submitted their own record - even if they have paid to be a member.

After registering I want them to pay for membership first then submit a record second. But to contact other members from the email field in their records they must have their own record as well. So if they pay but do not submit a record they still cannot see the email field.

How can I achieve this? Thanks for your help.

Последние изменения: 27 Март 2014


Sergey
Total posts: 13,748
17 Март 2014 04:51

This, you can make only with custom template. Right there calculate how many records current user have in a section and check if field is there.

Field may be restricted by subscription.


Sergey
Total posts: 13,748
25 Март 2014 07:25

Can you make custom template as you need it without this feature? I mean you do all you ned and then I only add this additional restriction?

It is very simple in fact you can use

$count = CStatistics::created($this->user->id, $this->section->id);
if(!empty($item->fields_by_id[10]) &&  $count > 0)
{
    echo $item->fields_by_id[10]->result;
}
elseif($count == 0)
{
    echo "To send email, add at least one record";
}

This is how you dould place a field.


Mel VIP
Total posts: 126
25 Март 2014 09:27

Hi Sergey, I already made a custom template so I added your code and it works great to restrict the ‘contact field’ when the user does not have a record, thanks very much.

Can the UddeIM private messaging system be restricted the same way?


Sergey
Total posts: 13,748
25 Март 2014 10:17

Mel Can the UddeIM private messaging system be restricted the same way?

The one that is in dropdown of the user name?


Mel VIP
Total posts: 126
25 Март 2014 10:24

No the 'PM' link is the one I will be using.


Sergey
Total posts: 13,748
25 Март 2014 11:39

You mean the one you insert into custom template? I think you can use the same IF statement.


Mel VIP
Total posts: 126
25 Март 2014 12:30

I'm sorry but I tried to integrate the code that goes in the custom template to show the 'PM' link but I couldn't make it work. I'm afraid I know nothing about php. The code is: <a href="/<?php echo JRoute::_('index.php?option=com_uddeim&task=new&recip='. $item->user_id); ?>">PM</a>

Your forum text editor still puts the / in the code above even though it cannot be seen in edit mode.


Sergey
Total posts: 13,748
26 Март 2014 05:35

Tell me more about this link. In what template you are placing it? List of full view?

Mel Your forum text editor still puts the / in the code above even though it cannot be seen in edit mode.

Yep. I still cannot findout why :)


Mel VIP
Total posts: 126
26 Март 2014 09:43

The link will be in the full view.


Sergey
Total posts: 13,748
27 Март 2014 06:36
<?php if(CStatistics::created($this->user->id, $this->item->section_id) > 0): ?>
    <a href="/<?php echo JRoute::_('index.php?option=com_uddeim&task=new&recip='. $this->item->user_id); ?>">PM</a>
<?php endif; ?>

Mel VIP
Total posts: 126
27 Март 2014 08:49

Thanks for your help Sergey, it works great.

Работает на Cobalt