Comments (5)
Yeah nice idea, I don't have time to add it right now but feel free to submit a pull request.
On 1 Sep 2016, at 18:46, Nathan Reed [email protected] wrote:
All widgets show correctly for other users, it would be good to have the widths duplicated for the widgets as well
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
from duplicateuserdashboard.
I don't have my whole Github setup yet, so here's my (ugly) fix :
$widgetRecords = $controller->getUserWidgetRecords($userIdToDuplicate);
$widgetModels = WidgetModel::populateModels($widgetRecords);
foreach ($widgetModels as $index => $widgetModel) {
$widgetModel->id = null;
craft()->dashboard->saveUserWidget($widgetModel);
// get newly saved widget
$widgetRecord = WidgetRecord::model()->findByAttributes(
array(
'sortOrder' => $index + 1,
'userId' => craft()->userSession->getUser()->id
)
);
$attr = $widgetModel->getAttributes();
craft()->dashboard->changeWidgetColspan($widgetRecord->id, $attr['colspan']);
}
from duplicateuserdashboard.
@doubouil Works for me. Thanks.
from duplicateuserdashboard.
I have added support for this to the plugin.
Thanks
from duplicateuserdashboard.
Works great! Thanks
from duplicateuserdashboard.
Related Issues (4)
- Does not work HOT 1
- Not working in Craft 2.6.2978 HOT 2
- Craft 3 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from duplicateuserdashboard.