Hot answers tagged

5

You may want to have a look at the cookie authentication plugin. It sets and reads a persistent cookie. It's found here: https://github.com/joomla/joomla-cms/tree/staging/plugins/authentication/cookie To read a cookie, you can use $app = JFactory::getApplication(); $cookieValue = $app->input->cookie->get($cookieName); To set a cookie, you use $...


5

The default behavior is like this: Cookie Domain: Joomla will use an empty value and the cookie will be valid for the current domain. Cookie Path: Joomla will use / as default value and the cookie will be valid for the whole site. Thus usually, the default values will be fine. The cookie domain may be useful if you want a cookie be valid for several ...


4

Below should work for you. This was taken from [This Answer][1] //GET JOOMLA COOKIES $inputCookie = JFactory::getApplication()->input->cookie; //GET SPECIFIC COOKIES DATA $value = $inputCookie->get($name = 'MyCookieName', $defaultValue = NULL); //CONDITIONAL STATEMENT TO RETRIEVE OR SET A COOKIE if(is_null($value)){ //SET YOUR COOKIE ...


3

Assuming you have a database table setup for this, you can use the following code to perform you check: // This function is taken from my own extension public function getIpAddress() { $server = $this->app->input->server; $clientIp = $server->get('HTTP_CLIENT_IP'); $httpFwd = $server->get('HTTP_X_FORWARDED_FOR'); if (!...


2

Simply this works for me <?php $options = array( 'active' => 'tab1_id' // Not in docs, but DOES work ); ?> <?php echo JHtml::_('bootstrap.startTabSet', 'ID-Tabs-Group', $options);?> <?php echo JHtml::_('bootstrap.addTab', 'ID-Tabs-Group', 'tab1_id', JText::_('COM_BOOTSTRAPTABS_TAB_1')); ?> <p>Content of the first tab.&...


2

This is not an answer to the question, but is a solution to the problem that prompted the question using the jQuery Cookie Plugin: jQuery(document).ready(function($) { var listItems = $("#tab_group_idTabs li"); var prefix = 'myID-'; listItems.each(function(li) { var a = $(this).children().first("a"); var word = a.attr('href')....


2

You could try using a plugin called Simple Pop-Up. It's a plugin that will display anything between {simplepopup} tags in a modal popup. The tags can be added to articles, modules or basically any part where the content can be processed by plugins. The plugin can be configured to load only once for each user. I haven't tested this, but if your form is ...


2

I would personally stay away from cookies in this instance, as they can be deleted from the browser. Instead, you would be better off (If the user must be logged in first): Creating a database table with a column called user_id Write a database query that gets executed once the form has been filled in and add the user ID to the user_id column in the ...


2

First of all you could first try to fit this code in your template. If may give you more flexibility there. onAfterRender does not seem right for me to fiddle the content and to set cookies / read cookies. Are you sure that your plugin is actually being called? Anyway, check your browser console to see the status.


2

Last time I did some research on this area (March 2013), I found this solution, which is not using JInput: I've inspected how JFactory calls JSession but I haven't found a way to set the expiration when storing data. Inside a system plugin, using the method onAfterRender() $cookie = session_get_cookie_params(); $cookie['lifetime'] = DESIRED ...


2

You should not load jQuery from google for a simple reason. There is almost 90% chance it will be loaded from system (so better require it from system like this: JHTML::_('jquery.framework')) so you lose both bandwidth and performance. Not to mention possible conflicts. If script you made don't work on Joomla page there is already a huge chance you have ...


2

I have had a similiar problem. And the solution was to configure better JCHoptimize. In my case it was a javascript conflict.


2

In the global configuration settings for Joomla there is a Cookie Domain setting - be sure this is set. Also be sure that you are accessing the site consistently. If you have set the domain to be for www.yourdomain.com but you access at just yourdomain.com, the cookie may not be present. Another consideration is when using ssl versus non-ssl.


2

Try using something like the following: $input = JFactory::getApplication()->input; $cookie = $input->cookie; $post = $input->post; $cookie->set('destinationcookie', $post->get('destination'), strtotime( '+90 days' )); $destination = isset($post->get('destination')) ? $post->get('destination') : $cookie->get($name = '...


2

The ‘Domain’ Attribute • With domain set, cookies will be sent to that domain and all its subdomains • The risk with subdomains is lower than when scoped to parent domain, but still relevant • Remove domain attribute to limit cookie to origin host only – Important note: IE will always send to subdomains regardless


2

The problem being your code will never work the first time cause your trying to set a cookie value based on the get value, which is always null as you're never setting the initial value. To set a cookie, you can use the following: $app = JFactory::getApplication(); // Get the cookie $value = $app->input->cookie->get('myCookie', null); // If ...


1

I went down this rabbit hole several years ago as a self-educating endeavor. You can go to the extent of leveraging a blend of server-side and client-side to sniff/frisk/detect a device. The truth is that all data that you might wish to process: can be spoofed/circumvented can naturally fluctuate/vary enough to trip up your algorithm can be missing ...


1

Just to clear a few things: I don't think there is anything that can tell this, not only in Joomla but in anything in the web. Under certain conditions you may be able to tell if a certain browser was at your site recently, e.g. like what G. Analytics does when counting new vs old visitors, which is a cookie based solution. But there is no real accuracy on ...


1

In joomla we had the Joomla Registration and login plugins and modules. if you can use it. it automatically generate the cookies also. use it. then you can get the good result.


1

The way you use cookies seems wrong, unless there is a library that you use here. According to quirksmode you would use something like if(window.location.href.indexOf("promotionpage") > -1) { document.cookie = 'landingpage=kent; expires=<?php echo date('D, j M Y H:i:s', time()+30);?> path=/promotionpage'); } This question has a good list of ...


1

A few of quick tips: Clear Joomla caches (through your FTP client - remove any cache files in the cache folder). Clear your browser's cache and cookies. Clear Sessions in Joomla database. Make sure the move of your site was complete and you didn't end up with any corrupted or missing files from the Joomla core. It will be good, if you still have a ...


1

In the Joomla backend go to: System (top menu) >> Global Configuration >> System and you will see an option called Session Lifetime which by default is set to 15. This value defines the minutes. You can change it to whatever you wish. Alternatively, you could use a plugin such as Session Keeper or Forever Sessions


Only top voted, non community-wiki answers of a minimum length are eligible