I have a site called www.mystorkparty.com where you can build a registry for your baby-shower.
Now I want to add a link so a user can email there registry link to friends.
I can use html and create a link that opens there email program - but how do I put in a the specific registry URL in automatically. Or should I do an internal email setup rather and send from my the site itself.
Whats the best option?
Thanks in advance.
You can make use of the mail_to helper for this. The mail_to helper allows you to specify a number of paramters such as :subject and :cc as optional arguments to pre-fil the link. You can also obfusicate the link using a number of options such as javascript or hex encoding.
An example link is similar to the link to method but looks like this:
mail_to "me#domain.com", "My email", :cc => "ccaddress#domain.com", :subject => "This is an example email"
This will create a mailto: link that will open the users default email client with the relevant values filled in.
Related
So I just chatted to one of line(one of social media) official accounts and they send me a message then when I clicked the button "Call us" it redirected me to my default calling application on my phone and filled out their number. Does anyone know how to do the same thing ?
That is probably an example of tel protocol.
You basically make an HTML link just like any other link, but rather than the href containing an http:// link, the link format looks like this:
tel:1-123-456-7890
When the user clicks it, their operating system sends this number to their default app for handling tel protocols, which is usually a phone app.
Here's an article useful for explaining this protocol, as well as some handy information about using it in CSS:
https://css-tricks.com/the-current-state-of-telephone-links/
I am following an example to add an email link, but after I click on Dynamic Links, it doesn't provide me with a default url, like in the picture (flutterauth.page.link). I get an empty box, no dropdown.
How do I get a Google provided page.link subdomain, like in the picture?
This is what mine looks like:
I figured out. It's very simple. The url is not pre-created, it doesn't show up by default. You have to start typing, and then you can create a url, if the url link is not taken.
Afer this, you will get a message:
myapp.page.link has been verified and approved for use
I am new to OSClass, right now when user publish a listing an email has been sent to user's email id, in which user can activate that listing, admin can also activate that listing.
But I want that only admin should have control to activate the listing, so if somehow I can control that if I skip that step of sending email to user's email account.
Is there any solution?
Regards.
You can remove the email sending removing the hooks.
Edit your oc-load.php file and add this lines:
osc_remove_hook('hook_email_new_item_non_register_user', 'fn_email_new_item_non_register_user');
osc_remove_hook('hook_email_item_validation_non_register_user', 'fn_email_item_validation_non_register_user');
osc_remove_hook('hook_email_item_validation', 'fn_email_item_validation');
If you doubts of hooks you can take a look at http://doc.osclass.org/Hooks
you can create a plugin for this and this way you don't modify the osclass core files, you can check how here http://doc.osclass.org/How_to_create_a_plugin
I am developing a facebook like social networking website using Yii framework. As a logged in user can see profile of any user they got while searching or by other means. in facebook it happens like
facebook.com/marthajoseph/photos
Here the user is viewing the profile of "marthajoseph". Same thing I want to achieve in yii.
Currently I did something like this
myapplication.com/index.php?r=u/default/index?uid=110
Here "u" is a model for users.
Here I am viewing profile of the user with user id "110". The issue is each time I switch the user's photos, profile, posts etc I have to append this uid query string with the url which leads to instability.
How can I achieve the facebook like thing?
I would suggest rewriting the URL completely using the Yii URL Management as mentioned by ernie above
First of all, use path format for the URL. This is done by firstly un-commenting the urlManager lines in protected/config/main.php (around line 34 by default). What this does is let you use "pretty URLs", for example, instead of the URL looking something like this:
www.example.com/index.php?r=user/profile?uid=110
You can have it something like this:
www.example.com/user/110
So, for example, if we wanted to route any URL which has the structure profile/<a users id> to our User Controllers view action (actionView), we could do something like:
'urlManager'=>array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
'user/profile/<id:.+>' => 'user/view',
...
So on the left side of the array we have "what the URL will look like", and on the right we have "where it is pointing". You can then access the id value in your view or in your controller using a $_GET, for example:
echo "You are viewing user id ".$_GET['id'];
You could use this value to query for photos or profile content or whatever associated with that user. In terms of having the users name in the URL (how facebook does it, eg: facebook.com/myusername), you would most likely let the user enter their vanity URL somewhere along the line and store that in the database. You could then change your rule to something like:
'user/profile/<user_vanity_url:.+>' => 'user/view',
And then access that value the same as above using a $_GET. One piece of advice if you go this route is to keep in mind that you should be preventing users from making being able to view content they are not allowed to view, for example, viewing the photos of someone who is not their friend. I would assume you have some sort of table storing these relations?
In regards to having to append the id or whatever value you are passing through the URL, you can simply append it in the view or wherever your HTML is being created, so for example if you want to display a link to the users photos from their profile page you could do something like:
One other thing regarding the URL rules in your urlManager, rules are interpreted from top to bottom, and the first matched rule will be used.
Hopefully this helps you on the right path. Check out the following posts if you are still stuck:
http://yiitutorials.net/easy/easy-url-rewriting-with-yii
Yii basic url rewrite
Any one know how to go back to the "last page" after a user is presented the login screen and chooses to create a new account?
Basically the sequence is this:
User tries to get to protected content
Redirected to login page
If he logs in he is redirected to original page
If he chooses "create new account" and fills it out, he is redirected to the home page
How do we get him automatically redirected to the original page (not a static page).
There are several ways to go about this. The most straight-forward is to have a login link somewhere in the navigation that appends the destination to the url. The code for this is something like:
<?php
if (user_is_anonymous()) {
$link = l(t('Login'), 'user/login', array('query' => drupal_get_destination()));
}
?>
You can also set a custom access denied page at admin/settings/error-reporting that could either go to a callback that outputs the above code, or to a simple php node that outputs that code.
Additionally, the user login block provided with Drupal core uses the same method to redirect a successful login back to the originating page.
Edit: Note that the above methods will rarely work for registration, because there are more steps involved there. Specifically, when a user needs to verify an email address, passing the originating destination along via the email would involve modifying the core user registration process.
It will potentially still work on a site configured to not verify email addresses. The idea then would be to provide 2 links: 1 for login and the other for registration, both passing along destination information.
LoginToboggan may also be worth pursuing, although it doesn't yet offer the exact registration feature you're looking for.
straight php would be to include a header of this form:
<?php header("Location: " . $_SERVER['HTTP_REFERER']); ?>
for more information refer to the php manual
EDIT:
you can also include a hidden field in your form and set it to
$url = $_SERVER['PHP_SELF']; // or HTTP_REFERER depending on the setup
include the header code snipped to your registration form.