Earthtracker's Blog

Just another WordPress.com weblog

Expressionengine template routes for first segment with regular expression

EE has a great tool for template routing, Developer sometimes faces problem with dynamic segment routing on first segment, then we need to use regular expression using regex. I didn’t find enough details about this on EE template routing docs. So after long hours of try, solved it.

Here is the example explained:
Club name should start with club here.

If the desired url like : domain.com/club-expresso/profile/shahed


{variable:regex[(club)]}/profile/{url_title}

Simple but very much useful!

Advertisements
Leave a comment »

Expressengine Assets file upload +no directory access in Channel form

Expressionengine Assets dont have any features to restrict file upload directory on channel form. So we use normal file input fields. But there is problem, it remove the selected file when next time the file is not updated.

So here the solution:
{member_photo}

<img src=”{url}” alt=”” />

<input type=”hidden” name=”member_photo” value=”{file_id}” id=”cur_file_id”>

<input type=”file” name=”member_photo” id=”file_upload”>

<input type=”hidden” name=”member_photo_filedir” value=”8″>

{/member_photo}

jQUery:
$(“#file_upload”).change(function (){ $(‘#cur_file_id’).val(”); });

Leave a comment »

Enable welcome HTML mail and error fix on Expressionengine user module (by Solspace)

I have been facing problem with the solspace user module’s welcome mail template enable HTML format, when i tried input inline styling , there was an error from ee security.
as template input is filtered by ee()->security->xss_clean, which used to test images for potential XSS attacks, useful for file upload security, I don’t think this should use here, as the html template can be updated by EE admin only.

To resolve this , i have changed the line from mcp.user.base.php
‘preference_value’ => ee()->security->xss_clean($_POST[$pref]),
to
‘preference_value’ => $_POST[$pref]

also to enable HTML formatted email you have to change the file:
mod.user.php line near the line : 5636, add ee()->email->mailtype = “html”; after : ee()->email->initialize();

This should resolve the issue, Cheers!

Read more

1 Comment »