Invitations
ExpressionEngine 2
Back to this add-on's main page
View Other Add-ons From Yuri Salimovskiy
Batch generate and send Mail
Feature Request
PP
|
Posted: 08 May 2012 07:16 AM |
|
|
|
It would be nice if the batch generate had on more field like send mail to each member.
So all members in the givne membergroup would receive a mail with x codes.
These members could use their mailed codes to invite new members.
|
|
|
Yuri Salimovskiy
|
Posted: 08 May 2012 12:12 PM |
# 1
|
|
Developer
|
I’ll consider implementing this
|
|
|
Yuri Salimovskiy
|
Posted: 08 May 2012 12:25 PM |
# 2
|
|
Developer
|
I’ll consider implementing this
|
|
|
PP
|
Posted: 05 August 2012 08:07 AM |
# 3
|
|
|
Since this is not implemented yet.
Is there another way to give existing users codes to invite new users. I know there is a template tag to generate codes. But there seems to be very little control over the codes. I want every user to have only one code. Is there a way to do this?
Cheers,
Phil
|
|
|
Yuri Salimovskiy
|
Posted: 05 August 2012 08:25 AM |
# 4
|
|
Developer
|
Hi Phil,
here’s what you can do:
{exp:invitations:display mode="my"} {if no_results} {exp:invitations:generate} {/if} {/exp:invitations:display}
I hope the logic is clear - display generate tags only if there are no codes generated by this user
|
|
|
PP
|
Posted: 06 August 2012 03:20 AM |
# 5
|
|
|
Great! Thank you.
|
|
|
PP
|
Posted: 06 August 2012 12:45 PM |
# 6
|
|
|
I am using the code you suggested like this.
[code
{exp:invitations:display mode=“my” limit=“1”}
{if no_results}
New Code: {exp:invitations:generate} – Copy and send to your friend.
{/if}
{if valid}
<li class=“mainmenu invite”>
Invite a new Artist</span>
</li>
{/if}
{/exp:invitations:display}
]
When a unregistered user visits the site he gets an EE error saying he must be logged in.
I am using above code in my main navigaton so the error is on every i page.
The solution would be of course wrapping {if logged_in} around the invitations tag. But it is ignored by invitations!
|
|
|
Yuri Salimovskiy
|
Posted: 06 August 2012 02:41 PM |
# 7
|
|
Developer
|
You’re right - this looks like a bug. I’ll fix this in next release, meanwhile you can replace this code
function generate() { if ($this->EE->session->userdata('member_id')==0) { $this->EE->output->show_user_error('general', lang('must_be_logged_in')); }
with this
function generate() { if ($this->EE->session->userdata('member_id')==0) { return $this->EE->TMPL->no_results(); }
|
|
|
PP
|
Posted: 07 August 2012 06:10 AM |
# 8
|
|
|
Thanks, it’s working now.
|
|
|
PP
|
Posted: 16 August 2012 04:37 AM |
# 9
|
|
|
I’m sorry but I think I found another one.
I am using following code
{if logged_in_member_id <= "70"} {exp:invitations:display mode="my" limit="1"} {if used}{/if} {if valid} <li class="mainmenu invite"> <span><a href="#">Invite a new Artist</a></span> </li> {/if} {if no_results} <li class="mainmenu invite"> <!-- {exp:invitations:generate} --> <span><a href="#">Invite a new Artist.</a></span> <li> {/if} {/exp:invitations:display} {if:else} {/if}
My logged_in_member_id check works, and the link will not be shown. However {exp:invitations:generate} will still be executed and members with a member_id higher than 70 will generate codes.
Also when a member with a lower id than 70 visits the site, {exp:invitations:generate} will be executed but the content of {if valid} will be shown instead of {if no_results}
|
|
|
Yuri Salimovskiy
|
Posted: 16 August 2012 04:44 AM |
# 10
|
|
Developer
|
It’s not a bug, it’s how conditionals in EE work. The code is parsed/executed in any case, {if..else} conditionals only determine what is getting displayed to user.
Try using switchee module or some advanced techniques (Low has some articles/advices about those)
|
|
|
PP
|
Posted: 16 August 2012 05:15 AM |
# 11
|
|
|
OK, I see. I already tried exp:ifelse but it didn’t work. I will try switchee. Thanks for the tip
|
|
|
PP
|
Posted: 24 August 2012 10:05 AM |
# 12
|
|
|
I still must be doing something wrong.
When I use ifelse no code is generated at all. When I remove ifelse codes are generated for everybody. Multiple times, even though my generate code is in no_results.
I tried to replace ifelse with switchee, but I don’t what variable I could use. I check for member_id < doesn’t work.
|
|
|
Yuri Salimovskiy
|
Posted: 27 August 2012 01:53 AM |
# 13
|
|
Developer
|
Hi Philip,
try adding some PHP to your templates (should be parsed on input)
<?php if ($this->EE->session->userdata('member_id') <= 70) { ?> {exp:invitations:generate} <?php } ?>
see also this reference on EE parsing order http://loweblog.com/downloads/ee-parse-order.pdf
|
|
|
PP
|
Posted: 28 August 2012 01:28 PM |
# 14
|
|
|
Hi,
I tried your php solution. It seems to be properly excluding the member_id > 70.
But still, there a multiple codes generated for users <70.
I am currently using s switchee solution. But it is acting the same as the php soltion. Multiple codes …
I cannot reproduce it. It is not on every pageload. Just sometimes.
|
|
|
PP
|
Posted: 05 September 2012 02:41 AM |
# 15
|
|
|
Are your working on this one? I’m wondering because you didn’t answer.
|
|
|