add register button

add register button

by m question -
Number of replies: 6

Hi,


I have question regarding theme ( I think)

how to add register button in the front page before log in

I found this thread, where Mary answered, but I don't know where to put that line of code

<a href="<?php echo $CFG->wwwroot'?>/login/signup.php"><button>Register</button></a>

adding it to SA>Apperance>Theme settings>CSS didn't work

I am using Moodle 3.2

I am testing many themes so I want where to add register button regardless of theme (it is either essential, adaptable, or boost)


thanks 

Average of ratings: -
In reply to m question

Re: add register button

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers

That code has to go in a php file so you'd need to add it in your specific theme.

You could simply add a link anywhere on your front page like this:

<a href="/login/signup.php">Register</a>

You could add it to an HTML block, or just a link in the topic section. Either way, it will stay on the front page regardless of which theme you use.


You could also add it to the custom menu, but that's a slight different format:

Register|/login/signup.php

See https://docs.moodle.org/32/en/Theme_settings#Custom_menu_items for more info.

Average of ratings: Useful (1)
In reply to Jon Bolton

Re: add register button

by m question -

thanks for your help, I appreciate it .

however, I want the button to be in front page next to the login button

I also tried your solution, but the HTML block keep appearing after login , and I don't want that

thanks again

In reply to m question

Re: add register button

by Fernando Acedo -
Picture of Plugin developers Picture of Testers

Using Adaptable you have several approach to add a register button in the frontpage.

You can use a marketing block, a moodle block, add a top menu or hack the code.

If you want a button beside the login button then the only way is hacking the code to add the button in the header.

This is the worst approach but is the only.

We do not expect to add the register button in the header because would be only useful for self-registration sites which is the less used authentication method. So it is not a priority.

Average of ratings: Useful (1)
In reply to m question

Re: add register button

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi MQ

You can convert the PHP part of the code to your Moodle site's URL

Also if you are using a Bootstrap based theme you can use this HTML instead:

<a class="btn btn-primary" href="http://yoursite.com/login/signup.php"><i class="fa fa-sign-in"> Register</i></a>

so that it looks like this...

Average of ratings: Useful (1)
In reply to Mary Evans

Re: add register button

by m question -

thank you so much

but I still don't know where to add it (which  php file)

I tried the HTML block suggestion but it keeps appearing in front page after login , and if user click on it, it gives error that you can't create account while you log in 

"Confirm: You cannot create a new account because you are already logged in as Admin User."

before login, the block won't show

also, I want the register button to be next to the log in button in the header (in adaptable theme for example) 

how to do that

log in button in theme

thanks again

In reply to m question

Re: add register button

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
try this...
<a id="signup-link" class="btn btn-primary" href="http://yoursite.com/login/signup.php"><i class="fa fa-sign-in"> Register</i></a>

Then add this to the Custom CSS box in Adaptable settings in ..

Administration >  Site Administration > Themes > Adaptable > General settings or one of the many listed for Adaptable.

#signup-link { display: none;}
.notloggedin #signup-link { display: block;}

Then save the settings.

Actually there is nothing stopping you adding this to the Frontpage summary block

then move it to top right of the page. 

Hope this helps?

Mary

EDIT: I've just edited this to fix some typos.

Average of ratings: Useful (1)