Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated

Flat theme and JS Toolbar

6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

Having JS Toolbar for login and similar purposes along with Flat welcoming message with another login form is overkill.
Is there a code that can display registration form instead of login form?
Modifying com_community\templates\Flat\layouts\frontpage\guest.php is not that much of an issue, few lines of code that displays jomsocial register will do ;)
Loading it as iframe is not elegant way.

Also, Register button from JS Toolbar messes up Register button from Flat guest.php form. Register from Flat guest.php ends with error:
Notice
Login failed
At the same time Register from JS Toolbar works as intended.
To fix this in Flat theme guest.php <button> for Register needs to be coverted to <a> and everything works.

6 years 7 months ago
Licenses:

HI, Vladimir.

Thank you for contacting us.
I passed your issue report to our developer.
I hope this will be covered ASAP.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

For those interested to implement Register instead of Login in Flat theme this is code for displaying JS Register form:

$view = JRequest::getCmd('view',null);
$layout = JRequest::getCmd('layout',null);

JRequest::setVar('view', 'register');
JRequest::setVar('layout', 'register');

$lang = JFactory::getLanguage();
$lang->load('com_community', JPATH_ADMINISTRATOR);

if (!class_exists('CommunityRegisterController')) {
require_once (JPATH_COMPONENT .DS. 'controllers' .DS. 'register.php');
}

$controller = new CommunityRegisterController();
$controller->execute('display');

if($view != null)
{
JRequest::setVar('view', $view);
}

if($layout != null)
{
JRequest::setVar('layout', $layout);
}

Can some of devs confirm this implementation is correct and not harmful in any way?

6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

Or maybe just this is enough:
$lang = JFactory::getLanguage();
$lang->load('com_community', JPATH_ADMINISTRATOR);

if (!class_exists('CommunityRegisterController')) {
require_once (JPATH_COMPONENT .DS. 'controllers' .DS. 'register.php');
}

$controller = new CommunityRegisterController();
$controller->execute('register');

<script>

// Validate form before submit.
function joms_validate_form( form ) {
if ( window.joms && joms.util && joms.util.validation ) {
// Prevents repeated clicks.
if ( window.joms_validating_form ) return;
window.joms_validating_form = true;
joms.jQuery('.joms-loading').show();

joms.util.validation.validate( form, function( errors ) {
if ( !errors ) {
joms.jQuery( form ).removeAttr('onsubmit');
setTimeout(function() {
joms.jQuery( form ).find('button[type=submit]').click();
}, 500 );
} else {
joms.jQuery('.joms-loading').hide();
window.joms_validating_form = false;
}
});
}
return false;
}

joms.onStart(function( $ ) {
function insertAuthkey() {
joms.ajax({
func: 'register,ajaxGenerateAuthKey',
data: [ '_dummy_' ],
callback: function( json ) {
joms.jQuery('#authenticate').val( 1 );
joms.jQuery('#authkey').val( json.authKey );
joms.jQuery('#login-form input, #form-login input, form[name=login] input').filter(function() {
return this.name.match(/[0-9a-z]{32}/);
}).prop( 'name', json.authKey );
}
});
}

var timer = setInterval(function() {
if ( joms.ajax ) {
clearInterval( timer );
insertAuthkey();
}
}, 100);
});
</script>

And also some modification to base.php needs to be done so copy from jomsocial theme \layouts\register\base.php to Flat same folder structure and modify line 19:
<form method="POST" action="<?php echo CRoute::getURI(); ?>"
onsubmit="return joms_validate_form( this );">
to look like:
<form method="POST" action="<?php echo CRoute::_('index.php?option=com_community&view=register&task=registerProfile&profileType=0'); ?>"
onsubmit="return joms_validate_form( this );">
Some css needs to be corrected to accommodate larger form:
.joms-landing__image {
min-height: 775px;
}
Is this correct implementation of this kind of modification?

6 years 7 months ago
Licenses:

HI, Vladimir.

It's fixed in latest version 1.0.1.
Please, download if from here: www.jomsocial.com/my-downloads
Install it by uploading package content here: ROOT/components/com_community/templates
Then browse to Backend -> Components -> JomSocial -> Theme Designer -> Colors and click SAVE button.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
6 years 7 months ago
Licenses:

HI, Vladimir.

Thanks for this nice hack.
Not all communities are using JS Toolbar so login for shoudl be displayed in theme.
But you may also disable it Theme Designer.
The rest will be just a customization if you prefer to have registration form there.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW