Create a back office for user profile with apostrophe cos

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Create a back office for user profile with apostrophe cos



I want to create a backoffice where the user can edit his profile, but I don’t know where to start.



I was thinking that I could start inspiring from the “contact form” tutorial, and adapt it to get all the user datas.
I don’t know if it’s a good idea ?



Hope someone can show me the way !



Fabien



=======



Edit 13-08-2018



I need more datas for the logged in user in the backoffice (such as billing/invoicing etc...)
I've started my Backoffice module, looking at what's Tom done for the signup module.
I've tried to addField to my backoffice module.


module.exports =
extend: 'apostrophe-users',
name: 'lionjar-backoffice',
alias : '_ljBo',
fields: ['firstName', 'lastName', 'username'],
backofficeUrl: '/backoffice',
addFields : [

label: 'Adresse',
name: 'address',
type: 'string'

],
beforeConstruct: function(self, options) */
,
construct: function (self, options)
self.pushAssets = function ()
self.pushAsset('script', 'user', when: 'user' );
self.pushAsset('stylesheet', 'user', when: 'user' );
;

self.apos.app.get(self.options.backofficeUrl, function (req, res)
if (req.user)
console.log(req.user);
req.scene = 'user';
/*req.browserCall('apos.modules["lionjar-backoffice"].enable(?)',
url: self.options.backofficeUrl,
schema: self.getSchema()
);*/
return self.sendPage(req, 'backoffice', schema: self.getSchema() );


);
self.getSchema = function ()

return self.apos.schemas.subset(self.apos.users.schema, self.options.fields.concat(['email', 'password','address']));
;



};



Nothing happen to my field list in browser side. My user thumbnail image field does not exist.
So I've create another module to add more fields to my user account.



in my module I did this


module.exports =
improve: 'apostrophe-users',
icons: false,
beforeConstruct: (self, options) =>
if (options.userthumb !== false)
options.addFields = [
name: 'userThumb',
label: 'Image de profil',
type: 'singleton',
widgetType: 'apostrophe-images',
options:
limit: 1,
aspectRatio: [1, 1]
,
help: "Ajoute une image au profil de l'utilisateur"
].concat(options.addFields




;



Now my user has one more field available in self.apos.users.schema



For the moment, I don't understand why my Backoffice module do not add this fields.
And, I didn't figure out how to populate browser side input with the data taken from backend !



If you can help.



Thks





This is something we plan to add when we get a chance... if you want to contribute it is fairly straightforward... look at the new apostrophe-signup module. Same idea, but for editing your existing profile, rather than creating a new account. Same use of a subset of the schema, etc. You could do it on a freestanding URL or via a modal.
– Tom Boutell
Aug 11 at 15:28









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered